It`s posible a CHAIN in CLP?

pts.
Tags:
RPG
Hi it's posible a chain in cl program?

Answer Wiki

Thanks. We'll let you know when a new response is added.

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.

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Walter47
    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 pointsBadges:
    report
  • reg
    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 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following