Is this possible

pts.
Tags:
AS/400
CLP
I am writing a cl that will run two seperate queries. the first builds a file. the second needs a parameter before it can be displayed. The parameter is a route range. We get the route from a production file. Is there away to do a read or a chain statement to a file that will allow me to get that information from that file to populate the parameter so there is as little human intervention as possible. thanks in advance.......

Answer Wiki

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

Unless it’s been enhanced, you can do sequential (but not random) reads in CL…look up DCLF & RCVF. If the file is large, you may want to run a query first that finds the needed information and write it to a small file…then use RCVF to read that file.

Discuss This Question: 3  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
  • Ashnirody
    There are many ways of getting a value from a file and passing it to your query with no human intervention. Your chosen method would depend on whether your second query is a Query/400 or QM Query. An SQL statement, Query Management Query, Query/400 or an HLL program could retrieve the value from the production file and write it to a single record file. Your second query, if it is Query/400, could access that file and use the information. If your second query is a QM Query, retrieve the value as before and pass it as a parameter to your second QM Query. Hope this helps.
    100 pointsBadges:
    report
  • Debbie54
    I have retrieved a random record in a cl using ovrdbf with position *KEY, and then rcvf. Here is an example, it retrieves a warehouse desc. from a table file, there are 4 keys to the table file with lengths 2,2,2,9. DCL VAR(&WSCO) TYPE(*CHAR) LEN(2) DCL VAR(&WSDIV) TYPE(*CHAR) LEN(2) DCL VAR(&KWH) TYPE(*CHAR) LEN(2) DCL VAR(&IN10) TYPE(*CHAR) LEN(1) DCL VAR(&DESC) TYPE(*CHAR) LEN(50) DCL VAR(&KEY) TYPE(*CHAR) LEN(20) DCLF MSTABLE CHGVAR VAR(&KEY) VALUE(&WSCO||&WSDIV||'26'||&KWH||' x') /* Above x is needed, system trims blanks */ OVRDBF FILE(MSTABLE) POSITION(*KEY 4 RECABLE &KEY) RCVF MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(ERROR)) CHGVAR VAR(&DESC) VALUE(%SST(&TDESC 1 50)) /* tdesc field from mstable */ GOTO CMDLBL(EOJ) ERROR: CHGVAR VAR(&IN10) VALUE('1') EOJ: ENDPGM
    0 pointsBadges:
    report
  • TomLiotta
    Note that it doesn't matter if it's Query/400 or a QM query. Both query types can accept parameters through the same STRQMQRY command. However, I'm not clear on the original question. Why not retrieve the value in the second query directly, through a sub-select or various other method. Why have the first query at all? Why pass a value in as a parameter when it can be pulled in from the file in the second query? But since we aren't shown either query, it's hard to show an appropriate example... especially when we aren't even told what OS release is involved. Tom
    125,585 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