PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 09/15/2016 6:35 PM by  Any ideas?
System Date in Job Parm
 7 Replies
Sort:
You are not authorized to post a reply.
Author Messages
Roger French
Private
Private
Veteran Member
(1266 points)
Veteran Member
Posts:522


Send Message:

--
05/16/2007 7:48 AM
    I saw an answer to this question on another board a few years ago.. but now I need to revisit it.

    I want to run a daily HR155 job and the History Date is a required field. If I set up the job in jobdef and then recdef I will need to hand key in a static History Date.

    How can I set it up so that for each day I run the job (scheduled through recdef) the job parameter screen will dynamically pick up the current system date and use that for the History Date? I know this question's been asked before. My initial thought is that the program will need to be modified to populate the History Date field with the current system date.

    Thanks in advance for your help,
    -Roger
    mondrar
    Private
    Private
    Advanced Member
    (85 points)
    Advanced Member
    Posts:35


    Send Message:

    --
    05/16/2007 6:29 PM
    I want to do the same thing in LP180. Any ideas anyone...
    John Henley
    Private
    Private
    Senior Member
    (9563 points)
    Senior Member
    Posts:3205


    Send Message:

    --
    05/18/2007 8:27 AM
    Off the cuff, I can think of three ways to do this:

    1. Create a shell or perl script that calls jobdump/jobload (or ujobdump/ujobload) to dump/update the date as part of the parameters in the job definition.

    2. Modify the desired job's COBOL code to change the desired date to the current system date. This introduces two problems:

    a) Assumes the program is always being run as part of a recurring job; what if the program is being run for a special case and NOT as a non-recurring job and you REALLY don't want to do to substitute the date?
    b) It's a maintenance headache--you now have (hopefully) a forked version of a standard Lawson program, which you have to maintain as part of CTP/MSP maintenance cycle.

    3. Create a separate COBOL program that runs before the desired recurring job(s). It has as parameters the username, jobname, step#, and byte position within JOBSTP-PARAMS for the desired date. That program would PERFORM 900-LOAD-JOB, change the date, then PERFORM 900-CREATE-JOB to modify the job record. This approach is general-purpose (i.e. you can use it for many different jobs/programs) and doesn't introduce the maintenance issues with option #2.
    Thanks for using the LawsonGuru.com forums!
    John
    Sam Simpson
    Private
    Private
    Veteran Member
    (673 points)
    Veteran Member
    Posts:239


    Send Message:

    --
    05/18/2007 11:17 AM
    I remember changing the .scr file and put @TD as the default value for dates. So if
    the parameter field is blank then the default is the system date/time. Hope this helps.
    John Henley
    Private
    Private
    Senior Member
    (9563 points)
    Senior Member
    Posts:3205


    Send Message:

    --
    05/18/2007 1:47 PM
    That's an interesting idea; the problem though may be that you have to do that change AFTER the recurring job is added. Otherwise the date field will be filled with the current system date on the day the job is added, and will remain that way unless you manually change the parameters field on the job definition.
    Thanks for using the LawsonGuru.com forums!
    John
    Nabil
    Programmer/Analyst
    St. Luke's Health System
    Veteran Member
    (105 points)
    Veteran Member
    Posts:47


    Send Message:

    --
    09/08/2016 5:24 PM
    Was there any good answer to this question? We'd like to use similar functionality and didn't know if Lawson provided an easy way to code a date parameter to today's date for a scheduled batch job.
    JimY
    Private
    Private
    Veteran Member
    (1089 points)
    Veteran Member
    Posts:389


    Send Message:

    --
    09/13/2016 6:40 AM
    The only way I was able to do this was to modify the program to grab the system date and populate the parameter field with it. You may also be able to do it through IPA, but I have not attempted it. You might check in the Lawson Process Flow forum to see if anyone has accomplished it and posted their results.
    Any ideas?
    Private
    Private
    Basic Member
    (41 points)
    Basic Member
    Posts:17


    Send Message:

    --
    09/15/2016 6:35 PM
    There is a better way in using curl and scripting it out instead of modifying it in 4gl.

    #!/usr/bin/ksh

    OK="Job Changed"
    DMPFILE='hahaha.dmp'
    JOB_UID=lawson
    JOB_PWD=iwonttell
    SERVERNAME=mywonderlandurl

    DATE=`date +%Y%m%d`
    curl -A 'Mozilla Firefox/2.0.0.17' --dump-header ${DMPFILE} -d "_ssoUser=$JOB_UID&_ssoPass=$JOB_PWD&_action=LOGIN&_fromLoginPage=TRUE&_language&_ssoOrigUrl=http://${SERVERNAME}/lawson/portal/logondone.htm" http://${SERVERNAME}/sso/SSOServlet

    MSG=$(curl -A 'Mozilla Firefox/2.0.0.17' -L -b ${DMPFILE} -d "_PDL=PROD&_TKN=WH110&_LFN=ALL&_RTN=DATA&_TDS=IGNORE&_OUT=XML&_EVT=CHG&FC=C&JOB-NAME=WH110&USER-NAME=$JOB_UID&COMPANY=1&LOCATION=1&ALLOCATE-DT=${DATE}&_EOT=TRUE" http://${SERVERNAME}/servlet/Router/Transaction/Erp? 2> /dev/null |grep "")

    if [[ "${OK}" = "${MSG}" ]]
    then
    echo "Success"
    else
    echo "Failed"
    echo $MSG
    fi
    rm ${DMPFILE}

    echo "Ok. Don't you think you should send a walmart gift card to the person who write this?"
    You are not authorized to post a reply.