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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command Language Help 1

Status
Not open for further replies.

kpnagle

MIS
Mar 31, 2001
13
US
I am trying to figure out how to create a CL program to call a program each morning on our AS/400. I couldn't find the appropriate forum on the web. The program requires the user to enter the date and one other parameter and then press <Enter> twice. Does anyone know how to send the keystrokes to the program? From reading the IBM manuals I couldn't find an example that seemed to do what I need. The best that I could tell is to use the SNDF command but I don't quite understand how to pass the appropriate information along. Thanks for any help you can provide.
 
Are you trying to automate this process with no user intervention at all? If so, just write a CL which will pull the system date and pass it to the RPG program with the other info as parms. You'll need to change the RPG by adding an *entry plist to receive the parms and recode to skip over the initial entry screen and go straight to processing the data. The CL can then be added to the job scheduler. I hope I understood your question correctly and that this helps.
 
Yes, you did understand me correctly. Thank you. The problem is that we didn't write the programs that we are trying to run and we don't have any RPG programmers in house. I have been using an old DOS machine to login and run scripts to start the program, but I want to get rid of this PC since this is the only function that it does. I have tried some scripting with Client Access and the Andrews Corp emulator without success so I thought that I should look into using CL. I was hoping that I wouldn't have to rewrite any code because that gets expensive and time consuming.
 
That's a stickier situation than I thought. I don't know that there is a solution other than rewriting a portion of the RPG to accept parms and skip over the part which requires user input. Possibly someone with knowledge of scripting may have another answer which will work for you. Good luck.
 
Here is the screen for the program that I am trying to run.
----------------------------------------------------------

CREATE EDI INVOICE FILE


Last Date Selection --------: 6/28/02 To 6/28/02


Enter Todays Date Selection : From To MDY

Enter Group Code to Use ----:
(Leave blank for all)

Enter File Number-----------:
ie: File Name is EDIINVXX 15 - Monday Transfer
16 - Tuesday
17 - Wednesday
18 - Thursday
19 - Friday
20 - Saturday


F1=Cancel
Make changes - press ENTER to continue
----------------------------------------------------------

Here is the CL that is called from the menu (RC0502CL)

PGM

DCL VAR(&WK1) TYPE(*CHAR) LEN(10)
DCL VAR(&WK2) TYPE(*CHAR) LEN(10)
DCL VAR(&WK3) TYPE(*CHAR) LEN(10)
DCL VAR(&WK4) TYPE(*CHAR) LEN(10)
DCL VAR(&WK5) TYPE(*CHAR) LEN(10)
DCL VAR(&WK6) TYPE(*CHAR) LEN(10)
DCL VAR(&WK7) TYPE(*CHAR) LEN(10)
DCL VAR(&WK8) TYPE(*CHAR) LEN(10)
DCL VAR(&WK9) TYPE(*CHAR) LEN(10)
DCL VAR(&WK10) TYPE(*CHAR) LEN(10)

CHGDTAARA DTAARA(QTEMP/MSGFILE (1 10)) VALUE('AFSMSG ')

CALL PGM(RC0502)

IF COND(%SWITCH(1XXXXXXX)) THEN(GOTO +
CMDLBL(ENDPGM))

/* EXTRACT AND INVOICE REPORT FILE CREATION */

CALL PGM(WKSELOE) PARM(&WK1 &WK2 &WK3 &WK4 &WK5 +
&WK6 &WK7 &WK8 &WK9)
CHGVAR VAR(&WK10) VALUE(&WK1)

SBMJOB CMD(CALL PGM(RC0503CL) PARM(RC0503CL &WK10))
JOB(RC0503CL)

SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('Job +
RC0503CL - EDI File Creation Submitted') +
MSGTYPE(*COMP)

ENDPGM:
ENDPGM
 
if you want it to automatically run you should add it to the system as a scheduled job entry using the WRKJOBSCDE command.
 
Thanks for the follow up. I am familiar with scheduling jobs so that is easy. I don't see how I can call this CL with another one because there are no parameters declared at the beginning, right? It is easy enough to copy this CL and make some changes but I don't understand why they have all of the variables declared and then only use one of them.
 
Your right, I don't fully understand what they are doing either. Upon closer look, it might be hard than what we thought. You have to change 'WKSELOE' probably, not the CL itself. :-(

Let us kow if we can be of more help. Mike Wills
AS400 Programmer
[pc2]

Please, if you find my post useful, let me know. [thumbsup2]
 
I think I am just going to have to take the plunge and learn some RPG. I have been using the AS/400 since 1993 and have always avoided learning too much about it since I am better able to program on the PC. Also IBM's documentation is quite intimidating as it is not always the easiest to read or follow. With the many online sources and forums, I should be able to get up to speed pretty quickly. Thanks again for your assistance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top