Posts

AS400 Debug Batch Programs

To debug batch programs through command-line entry, use the following steps:

To debug batch programs through command-line entry

  1. If LAWENV is not called as part of your user profile’s sign-on program, you must call the LAWENV program to set the environment variables correctly.
    1. At the IBM i command line, type
      CALL LAWENV
    2. Type the name of an Environment and press Enter.
  1. Compile the program you want to debug. At the Qshell command line, type
    qcompile -D productline systemcode programcode

Note: If you need to include modules in the compile, use qcompile -Dm productline systemcode programcode .

  1. Submit the program to a job queue that is on hold or is not tied to a subsystem (so that the batch job does not execute).
  2. Start a service job for the program.
    1. Get the job information by typing at the IBM i command line,
      WRKJOBQ QueueName
      where QueueName is the job queue to which you submitted the batch program.Select option 5 (Work with) for the job queue and then write down the job, user, and job number information for the appropriate job.Note: You can also use the WRKUSRJOB command to find the job information, but this may yield a much longer list of jobs to view in order to find the one you need.
    2. At the IBM i command line, type:
      STRSRVJOB JobNumber/UserName/JobName
  1. Start debug. At the command line, type STRDBGand prompt it (F4). Make sure the library is the one where you compiled the source and that UPDPROD(*YES) is set. If the information is correct, press Enter.
  2. When source listing appears, press F12to resume.
  3. Start the batch program by changing the job to run in an active queue. On the “Work with Job Queue” screen, enter 2(Change) to change the job queue for the job. After typing in the job queue name, press Enter.The ILE debugger will display the “Start Serviced Job” screen with the following message: “The serviced job has been released from the job queue. Press Enter to start the job or F10 to enter debug commands for that job.”
  4. Press F10and then at the IBM i command line, type:DSPMODSRC
  1. Set break points (F6), then press F12, and then press F3 to return to the “Start Serviced Job” screen.
  2. Press Enterto run the program.
  3. After finished with debugging, end debug and the service job. At the IBM i command line, type:
    ENDDBG
    thenENDSRVJOB

AS400 Debug Online Programs

To debug online programs through command-line entry, follow these steps:

  1. If LAWENV is not called as part of your user profile’s sign-on program, you must call the LAWENV program to set the environment variables correctly.
      1. At the IBM i command line, type
        CALL LAWENV
      2. Type the name of an Environment and press Enter.
  1. Compile the program you want to debug. At the Qshell command line, typeqcompile -D productline systemcode programcode

Note: If you need to include modules in the compile, use qcompile -Dm productline systemcode programcode .

  1. End any jobs using the previously compiled version of the program. At the IBM i command line, type:CALL TMCONTROL PARM(’-rp’ Productline Program)

Example (IBM i command line):

CALL TMCONTROL PARM(’-rp’ LAWAPP9 PR14)

  1. Access the online form either through Lawson Interface Desktop (LID) or Lawson for Infor Ming.le, and perform a transaction.
  2. Start a service job for the program.
    1. Get the job information by typing at the IBM i command line:WRKACTJOB SBS(Subsystem)

      Find the appropriate LATMProgramName job in the appropriate subsystem, and then select option 5 (Work with). Select option 1 to confirm that it is the correct job. If it is correct, return to the previous screen and note the job number, user name, and job name (which will be LATMProgramName).

      Note: You can also use the WRKSBS command to find the appropriate subsystem and then LATMProgramName job.

    2. At the IBM i command line, type:

      STRSRVJOB JobNumber/UserName/JobName
  1. Start debug. At the IBM i command line, type STRDBGand prompt it (F4). Make sure the library is the one where you compiled the source. If the information is correct, press Enter.
  2. When source listing appears, set break points (F6), then press F12.
  3. Perform another transaction with the online program.
  4. After finished with debugging, end debug and the service job. At the IBM i command line, type

ENDDBG

then

ENDSRVJOB

AS400 Database Maintenance Commands

A common AS400 Database Maintenance Command – Finding and Fixing Dictionary Issues – is a quick task to complete. Follow these simple steps:

  1. Use the Verify Dictionary utility when you suspect dictionary mismatches such as missing objects or mismatched columns.
  2. Use the Build Data Definition Language utility to correct these issues or others, when you do not want to use the reorganization process.
  3. Use the Verify Dictionary (verifyibm) utility to check the two definitions.

If any problems are identified, you should use the Build Data Definition Language utility (bldibmddl) to modify an object (table or index) that needs rebuilding or modification. These utilities are used from a Lawson command prompt.

AS400 Disk space usage

In AS400, it is convenient to know where all your data is distributed as well as how much disk space you have consumed and have leftover to use. If you want easy access to all this information at hand, all you need to do is run a simple command.

 

To get your AS400 Disk space usage, use the following command in your green screen command line:

 

Dspsyssts

 

On the right-hand top corner, you will see the sizes listed. You can run this command as often as you need to keep track of your disk space usage on a daily (or periodic) basis.

AS400 recdef jobs listing

There is not a delivered report that you can run to list out your recdef jobs. The file that holds the recdef data is called recurjob in your Gen Database Collection.

 

To get a report of all recurring jobs that are set up in recdef on AS400, follow these instructions:

From the AS400 command line type; CALL LAWENV  hit enter and choose the subsystem in which you want to dump the records from.

qsh

rngdbdump -c GEN recurjob > /home/userprofile/recdef.csv (a dump of all recurring jobs that exist in recdef)

You can now use the wrklnk command to look in the directory listed in the rngdbdump command above to see the csv file that was created with these recurjob records.

wrklnk ‘/home/userprofile/recdef.csv’  place a 2 next to the file and hit enter

or

map a drive to your IBM i  root directory via Windows Explorer and open the .csv file from there.

or

use the System i  Navigator to open the file

How to find your lawappinstall version on AS400

Want to know how to check your lawappinstall system version on AS400? This quick guide explains how you can find out what version of the AS400 you are using on your operating system. There may be more than one way of doing this but this, we’ve found, to be a very simple solution.

 

To find your version of lawappinstall, you will need to run the command(s) below that correspond:

 

  • IBM® i®:
    call lawenv [envName]
    qsh
    grep LaVersion $GENDIR/bin/lawappinstall | sed “s/.*8-)@(#)@//”

If ran correctly, the screen will display your system’s version. Here is an example version output from each platform:
10.0.9.0.1807 2020-09-17 18:28:22

 

That’s it! Hope you found this article helpful.

AS400 Lawson IBMDB program CDRIVER

On the iSeries/AS400, A CDRIVER is a Lawson IBMDB program written in “C Language” and runs on the System i platform.

Its primary use is to retrieve data from DB2 using Structured Query Language (SQL)/Call Level Interface (CLI) Application Program Interfaces (APIs).

Furthermore, Lawson Jobs are using CDRIVER. Each Lawson Job has its own CDRIVER per Data Area or Product Line. Its purpose is to run SQL commands to retrieve database records requested by the job connected to it. The job name will be automatically registered in the CDRIVER joblog and the job that is attached to it may change if REUSE is set to “ON” in the ladb.cfg.

AS400 Lawson srgen command

When running SRGEN in Lawson on iSeries/AS400 there are some things to consider. first, make sure you have the lawson source library LAWSRC in your library list. If the LAWSRC source library is not in your library list, your screen rules will not be updated. You should also make sure to put LAWSRC above your modification library and make sure they contain lawson source files as well as the .sr members before you run SRGEN. Lastly, the syntax for running SRGEN is CALL SRGEN PARM(LAWAPP SYSTEMCODE), where systemcode is your Lawson system code (i.e. HR). If you need to create screen rules (.sr) for multiple system codes, separate the system codes with a single space (i.e. HR GL AP IF AR).

Installing a CTP on AS400

To Install a CTP on AS400, follow these guidelines:

 

Open a green screen and go to command line:

Enter the following commands:

call lawenv

qsh

cd $LAWDIR (or location of tar files)

The Versions file is EBCDIC instead of ASCII. You will use /QOpenSys/usr/bin/tar to unpack package.

Otherwise, you will get this error:

Error: Versions file is wrong CCSID.

If so, you will need to remove all untarred files from directory and start over with QOpenSys/usr/bin/tar

 

/QOpenSys/usr/bin/tar -xvf 9.0.1_patch_84930.tar                  

   x 9.0.1_patch_84930.readme.html, 331911 bytes, 649 media blocks.            

   x Versions, 5816 bytes, 12 media blocks.                                    

   x Tasks, 3034 bytes, 6 media blocks.                                        

   x patch.tar.Z, 2483873 bytes, 4852 media blocks.                            

   $                                                                           

 perl $GENDIR/bin/lawappinstall preview ProdLineName                              

 perl $GENDIR/bin/lawappinstall update ProdLineName                              

 perl $GENDIR/bin/lawappinstall activate ProdLineName                              

 

check for errors

ls $LAWDIR/ ProdLineName/rpg/*rpg/*SRC/*.err

Hit F3 to exit command line

Dspmsg to Display messages

If you find any failed job enter

Wrkjob # for failed job