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

AS400 CLP,, parameters and lda

Status
Not open for further replies.

jmd0252

Programmer
May 15, 2003
667
0
0
Are there any cl gurus out there. I prompt thru cl for 2 dates,,, the load them into the LDA,, then change them via an RPG program to julian,,, but in order to use the %range paramter on a qryslt statement I have to reload the changed dates back into the 2 declared variables,,, so how do I do that??

 
Never Mind,,,, figured it out,,, anyone have experienc in using the opnqryf command.????
 
ok,,, I have the following in my cl

CHGDTAARA DTAARA(*LDA (1 6)) VALUE(&RFDAT)
CHGDTAARA DTAARA(*LDA (7 6)) VALUE(&TFDAT)

CALL PGM(LABDATE) PARM(&RFDAT &TFDAT)

CLRPFM FILE(HCCCUSTOM/LABEQP)

OVRDBF FILE(F0911) TOFILE(*LIBL/F0911) SHARE(*YES)

OPNQRYF FILE((F0911)) OPTION(*INP) QRYSLT('GLOBJ *EQ +
''6323 '' *AND GLDGJ *EQ %RANGE('' *CAT +
&RFDAT + *BCAT &TFDAT *CAT'')')


but the statement does not run I get the following..

> call labwkclea
ENTER MONTH BEGIN DATE - MMDDYY
? 010196
ENTER MONTH ENDING DATE - MMDDYY
? 060103
Member LABEQP file LABEQP in HCCCUSTOM cleared.
1 arguments for built-in function %RANGE not valid.
Error occurred during processing of command.
CPF9899 received by LABWKCLEA at 2700. (C D I R)
? D


and since I have not used the opnqryf command that much,, I am trying to figure out what is happenig,, and where I am going wrong.

Thanks

Jim

 

Try this

%range(' *cat &rfdat *cat ' ' *cat &tfdat *cat ')


grace
 
grace,,

Well when I promopt change it sel statement to yours,, here is how it comes out.


OPNQRYF FILE((F0911)) OPTION(*INP) QRYSLT('''GLOBJ +
*EQ "6323 " *AND GLDGJ +
%RANGE(''*CAT&RFDAT*CAT'' +
''*CAT&TFDAT*CAT'')''')


and here is the error I get when I run it..

> CALL LABWKCLEA
ENTER MONTH BEGIN DATE - MMDDYY
? 010196
ENTER MONTH ENDING DATE - MMDDYY
? 060103
Member LABEQP file LABEQP in HCCCUSTOM cleared.
Character ''' following string 'CAT ' not valid.
Error occurred during processing of command.
CPF9899 received by LABWKCLEA at 2700. (C D I R)
? D
> DSPJOBLOG

Any ideas.??

Jim

 
opnqryf is notorious for its adding of extra ticks ''''

Lets try this again, your qryslt statement should be

('GLOBJ *EQ "6323 " *AND GLDGJ *EQ %RANGE(' *cat &RFDAT +
*cat ' ' *cat &TFDAT *cat ')')

note: there needs to be a space before and after each cat & also a space between the two cats in the middle. If you still can't get this to work would you like to email me off list? I'm afraid some of the formatting on this page makes this code look different.

I set up a small test before I answered your question so I know this can be done.

hope this helps

grace
 
Grace,,

OK,, well I entered everything by hand,, and did not do the prompting IE F4..

it complies.,.. but gives me the following job log.

Member LABEQP file LABEQP in HCCCUSTOM cleared.
Character in string 'O96 0' in expression on parameter QRYSLT not
valid.
Error occurred during processing of command.
CPF9899 received by LABWKCLEA at 2700. (C D I R)
D
so I went back and check the program before that ,, where I get the dates set in the parameters,,
here is a copy of that..
+....1....+....2....+....3....+....4....+....5....+....6....+....
FROM 096001 TO 103152

So,,, What the heck is going on?? This is something I am trying to get the job to run quicker,,, so any help is greatly appreiciated..

Jim

 
CALL PGM(LABDATE) PARM(&RFDAT &TFDAT)
Is this program actually filling these dates?

Was that a picture of your lda?

Is that data in the lda correct? Your cl program says to pick up the dates in 1-6 & 7-12. Also what about the date that says 096001?

I know there are a lot of questions here but I'm trying to figure out what is happening & the sequence of events.

Do you know how to debug a cl program?

grace
 
yes,,, that is what the printout shows,, I setup a printer file in the program,, and printed the contents of the paramters, right before I seton LR. The dates are originally entered as 010196,, and 060103,, when the julian routine runs,, it says the first 3 bytes are the century,year,, ie 096 for 1996,, and 103,, for 2003, the last 3 bytes are the julian day of the year..and in the program the paramters are defined as 6/0. They come from the LDA, loaded by the cl,, and converted,, and put into the parameters. And NO,, I do not have any idea how to debug a CLP.

The acutal clp looks like this..

DCL VAR(&RFDAT) TYPE(*CHAR) LEN(6)
DCL VAR(&TFDAT) TYPE(*CHAR) LEN(6)
SNDUSRMSG MSG('ENTER MONTH BEGIN DATE - MMDDYY') +
TOMSGQ(*) MSGTYPE(*INQ) MSGRPY(&RFDAT)
SNDUSRMSG MSG('ENTER MONTH ENDING DATE - MMDDYY') +
TOMSGQ(*) MSGTYPE(*INQ) MSGRPY(&TFDAT)
CHGDTAARA DTAARA(*LDA (1 6)) VALUE(&RFDAT)
CHGDTAARA DTAARA(*LDA (7 6)) VALUE(&TFDAT)

CALL PGM(LABDATE) PARM(&RFDAT &TFDAT)

CLRPFM FILE(HCCCUSTOM/LABEQP)

OVRDBF FILE(F0911) TOFILE(*LIBL/F0911) SHARE(*YES)

OPNQRYF FILE((F0911)) OPTION(*INP) +
QRYSLT('GLOBJ *EQ "6323 " *AND GLDGJ *EQ +

 
Try this:

[tt]
OPNQRYF FILE((F0911)) OPTION(*INP) QRYSLT('GLOBJ = +
"6323 " *AND GLDGJ = %RANGE(' *CAT +
&RFDAT *BCAT &TFDAT *CAT ')')
[/tt]


"When once you have tasted flight, you will forever walk the Earth with your eyes turned skyward, for here you have been, and there you will always long to return."

--Leonardo da Vinci

 
I should explain. The *BCAT inserts a blank before the next string, so when the variables are substituted, you get the expression

[tt]GLDGJ = %RANGE(096001 103152)[/tt].

If you use *CAT instead, you will get

[tt]GLDGJ = %RANGE(096001103152)[/tt]

which is not valid for OPNQRYF's %RANGE function (it needs two arguments).


"When once you have tasted flight, you will forever walk the Earth with your eyes turned skyward, for here you have been, and there you will always long to return."

--Leonardo da Vinci

 
I had tried that ,,, changeing the second set of *cats, to a *bcat,, giving you the blank,, is something,, but you have to keep the single quotes at the end of the first *cta, and at the beginning of the *bcat,, otherwise it kicks on Syntax..
 
but the clp, still kicks at the same spot,, with the same message,, ???? go figure..???
 
I prompted the statement on an AS/400 in PDM, and the syntax should be correct..


"When once you have tasted flight, you will forever walk the Earth with your eyes turned skyward, for here you have been, and there you will always long to return."

--Leonardo da Vinci

 
Okay, one more try:

[tt]
OPNQRYF FILE((F0911)) OPTION(*INP) QRYSLT('GLOBJ = +
"6323 " *AND GLDGJ=%RANGE(' || &RFDAT +
*BCAT &TFDAT || ')')
[/tt]



"When once you have tasted flight, you will forever walk the Earth with your eyes turned skyward, for here you have been, and there you will always long to return."

--Leonardo da Vinci

 
ok,,, before I try that one,,, take a look at this,,, here is a printout I generated showing the values of the variables, ,, in hex they looks good,,, but what has happened in Char form.??

Variables
Variable Type Length Value
*...+....1....+....2....+
&RFDAT *CHAR 6 ' o 96'
&TFDAT *CHAR 6 ' 03'
* * * * * E N D O F D U M P

(right side)..

Variables
ue Value in Hexadecimal
..+....1....+....2....+ * . . . + . . . . 1 . . . .
96' 0096001FF9F6
03' 0103152FF0F3
E N D O F D U M P * * * * *



now isn't that a kick in the head.. any ideas.????

 
Looks like your data is being corrupted before it gets to the OPNQRYF statement.

Your problem is what you are putting in the *LDA - that appears to be offset incorrectly. But the OPNQRYF statement I posted should work fine.


"When once you have tasted flight, you will forever walk the Earth with your eyes turned skyward, for here you have been, and there you will always long to return."

--Leonardo da Vinci

 
Wait a minute - those dumps show the data in packed decimal. Try retrieving those into *DEC fields and then CHGVAR to the fields you will use in the OPNQRYF.


"When once you have tasted flight, you will forever walk the Earth with your eyes turned skyward, for here you have been, and there you will always long to return."

--Leonardo da Vinci

 
ok,,, I have tried changing the original declare variable,,, but I get an err on my prompt for the user to enter dates,,, if I use a chgvar,,, since I have never used one before. How and Where.????

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top