0 pts.
 It`s posible a CHAIN in CLP?
RPG
Hi it's posible a chain in cl program?

Software/Hardware used:
ASKED: October 19, 2007  8:45 AM
UPDATED: October 24, 2007  3:04 PM

Answer Wiki:
No, it is not possible to CHAIN in CLP. You have several options: 1) You can either read through the entire file until you get to the record you want 2) Use OpnQryF and then read through the resulting records. 3) I you are always looking for the same record you can create a Query to put the record into a temporary file (in QTemp) and then read that record in your program 4) Create a Query Manager Query and pass it the parameters for the record(s) you are looking for and have it create a temporary file. That's all I can think of at the moment. Also remember that you can only read a a file through to EOF once in CL so if you need to get, for instance, several records with different parameters you can create a CLP sub-program to read the file for you.
Last Wiki Answer Submitted:  October 23, 2007  2:52 pm  by  Vatchy   1,410 pts.
All Answer Wiki Contributors:  Vatchy   1,410 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

I’m not sure exactly what you are wanting to do. Can this be run in Batch or must it be interactive?
This is not to improve the above answer, but to add another perspective. No you cannot Chain.
Another option would be to create a logical file with the records you want. It would elliminate the need for Open Quary File.

Jack

 120 pts.

 

CL does give you the capabilty to ‘chain’ to a data file. We created a file with holiday dates (eg. 070407) that take place in the work week. If the CL program gets a hit on this record (070407) it bypasses processing steps (eg. large print jobs. Have attached code snippet.
PGM
DCL VAR(&CURRDT) TYPE(*CHAR) LEN(6)
DCLF FILE(BYPSDATE)
/* GET CURRENT DATE AND SEE IF IT IS IN BYPSDATE FILE */
RTVSYSVAL SYSVAL(QDATE) RTNVAR(&CURRDT)
OVRDBF FILE(BYPSDATE) POSITION(*KEYAE 1 *N &CURRDT)

RCVF
/* IF EOF, AS NO RECORD FOUND IN BYPASS DATE FILE, SKIP COMPARISON */
MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(SKPCMP))

/* IF DATE IS IN FILE DO NOT RUN NEXT JOB */
IF (&CURRDT *EQ &HLDYDT) +
THEN(DO) /* DATE IN FILE */
GOTO CMDLBL(SATSUN)
ENDDO
SKPCMP:
CALL PGM(LRGPRTJOB)
SKPPRT: ENDPGM

 280 pts.