Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Easiest way to execute a CLPFM from within an RPG program 1

Status
Not open for further replies.

ColumbiaDiver

Technical User
Jul 27, 2002
35
US
All,

I have a quick question that I hope will have an equally quick answer. I have an RPG program that is used to run part of our payroll process. The RPG program populates a data file that gets transmitted to the company that maintains our retirement. The vendor process for our regular payroll cycles that runs this program has the ability to execute a series of commands prior to running executing the RPG program. One of the commands that I execute is CLRPFM I403B as the RPG program populates this file with new data for our retirement vendor with each payroll run.

Unfortunately, the vendor process functionality only works for payroll runs which are batch, (ie our standard payroll process). However, now I need to setup this program to run for on-demand check processing, which is interactive not batch. The result is that I now need to execute the CLPRM IT403B from within the RPG program itself.

Is there a quick and easy way to accomplish this? I have seen references to using the QCMDEXC API, using the SYSTEM API etc. I was hoping someone could tell/show me the simplest way to accomplish this.

I believe the code is RPG III or IV (not sure how to tell), since I do very little RPG related stuff, mainly just making small changes to existing programs. The system is running V6R1M0.

Any help would be appreciated.
Thanks
Gordon
 
I have seen two ways to do this.

One is the QCMDEXEC API. That is pretty simple to use: (Off the top of my head, but it should be close).

The important thing is that the field LENGTH which is the second parameter on the call needs to be defined as 15 long with 5 decimal places. The LENGTH parameter holds the value of the length of the command - 'CLRPFM I403B' is 12 long.


Code:
C                   Z-Add     12            LENGTH           15 5
C                   EVAL      CLRPFM = 'CLRPFM I403B'
C                   Call      'QCMDEXC'           
C                   Parm                    CLRPFM   
C                   Parm                    LENGTH

The other way is to create a CL program that clears the file and call it. This code assumes you have created a CL program called CLEARCL.

Code:
C                   Call      'CLEARCL'

Tom

I keep trying to do something about my procrastination but I keep putting it off until tomorrow.
 
You will have to make the file USROPN and open it only after you've cleared it.

Example:

Code:
      FI403B     IF   E           K Disk    [COLOR=#EF2929][b]Usropn[/b][/color]


And here'se the initialization subroutine (which gets executed before anything else):

Code:
  
     C     *INZSR        BEGSR                                        
     C                   EVAL      CLRPFM = 'CLRPFM I403B'            
     C                   Call      'QCMDEXC'                          
     C                   Parm                    CLRPFM           12  
     C                   Parm      12            LENGTH           15 5
     C                   Open      I403B                              
     C                   ENDSR

-- Francis
Francisus ego, sed non sum papa.
 
Tom and Francis,

Excellent. That's exactly what I was looking for. I really appreciate your taking the time to help me out.

Take care.

Gordon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top