System Date in Job Parm

 7 Replies
 1 Subscribed to this topic
 27 Subscribed to this forum
Sort:
Author
Messages
Roger French
Veteran Member
Posts: 549
Veteran Member
    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
    Advanced Member
    Posts: 35
    Advanced Member
      I want to do the same thing in LP180. Any ideas anyone...
      John Henley
      Posts: 3353
        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
        Veteran Member
        Posts: 239
        Veteran Member
          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
          Posts: 3353
            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
            Veteran Member
            Posts: 61
            Veteran Member
              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
              Veteran Member
              Posts: 510
              Veteran Member
                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?
                Basic Member
                Posts: 20
                Basic Member
                  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?"