View previous topic :: View next topic
|
Author |
Message |
gchitra
New User
Joined: 08 Jun 2005 Posts: 36 Location: Burtonsville, MD
|
|
|
|
Hi,
I am converting a CLIST program into REXX and would like to know the REXX equivalent for the following CLIST statement.
SET ENRCD = &NRSTR(&EFILEIN)
Can anyone please help me?
Thanks,
Chitra |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
What does the NRSTR function do ? |
|
Back to top |
|
|
gchitra
New User
Joined: 08 Jun 2005 Posts: 36 Location: Burtonsville, MD
|
|
|
|
This is what I got from a CLIST reference material:
Quote: |
Preserving double ampersands - &NRSTR You can use the &NRSTR built-in function to prevent a CLIST from: v Removing the first ampersand when it encounters a character string with a prefix of double ampersands. v Performing more than one level of symbolic substitution on a variable.You can use &NRSTR with JCL statements that include the name of a temporary data set (for example, &&TEMP). Using &NRSTR prevents a CLIST from changing the name of a temporary data set (&&TEMP) to a symbolic parameter (&TEMP). Double ampersands To assign the character string &&DATA to the variable &FILE, code: SET FILE = &NRSTR(&&DATA)
|
|
|
Back to top |
|
|
gchitra
New User
Joined: 08 Jun 2005 Posts: 36 Location: Burtonsville, MD
|
|
|
|
Can anyone please help me with this? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Suggest you look at the functionality of the clist (or routines within it) and convert on a larger scale rather than trying to do a line-for-line change of the code.
The good news is that with the already working clist, you should have no doubt that your new code works properly. |
|
Back to top |
|
|
gchitra
New User
Joined: 08 Jun 2005 Posts: 36 Location: Burtonsville, MD
|
|
|
|
This is what we have in CLIST:
Code: |
READEDSN: +
ALLOC FI(EFILEIN) DA(&SYSCAPS('&DSNIN')) SHR
SET EOF = F
OPENFILE EFILEIN INPUT
READEREC: +
IF &JOBNU > 99 THEN +
DO
WRITE LAST FILE PROCESSED WAS &CPYIN
WRITE ONLY 90 FILES CAN BE PROCESSED AT ONE TIME
WRITE PLEASE RUN REST OF THE FILES SEPARATELY
GOTO FINI
END
GETFILE EFILEIN
SET ENRCD = &NRSTR(&EFILEIN)
IF &ENRCD = &STR(ENDOFFILE) THEN GOTO ALLDONE
SET APPLID = &STR(&SUBSTR(1:3,&ENRCD)
SET CPYIN = &STR(&SUBSTR(4:50,&ENRCD)
|
The value for ENRCD should be first record in the file EFILEIN. But when I converted it into REXX, the value for ENRCD becomes EFILEIN and not the record in EFILEIN.
Following is the converted REXX Code:
Code: |
READEDSN:
"ALLOC FI(EFILEIN) DA('"DSNIN"') SHR"
EOF = "F"
"EXECIO 0 DISKR EFILEIN (OPEN"
READEREC:
IF JOBNU > 99 THEN
DO
SAY "LAST FILE PROCESSED WAS " CPYIN
SAY "ONLY 90 FILES CAN BE PROCESSED AT ONE TIME"
SAY "PLEASE RUN REST OF THE FILES SEPARATELY"
SIGNAL FINI
END
"EXECIO * DISKR EFILEIN"
ENRCD = EFILEIN
SAY 'ENRCD : ' ENRCD
IF ENRCD = "ENDOFFILE" THEN SIGNAL ALLDONE
APPLID = SUBSTR(ENRCD,1,3)
CPYIN = SUBSTR(ENRCD,4,47)
|
With the SAY statement, I found out that the value for ENRCD is not as expected. I also tried different ways to function it the same way as that of CLIST, but in vain.
So can you please help me out?
Thanks,
Chitra |
|
Back to top |
|
|
MBabu
Active User
Joined: 03 Aug 2008 Posts: 400 Location: Mumbai
|
|
|
|
The problem isn't &NRSTR... read up in EXECIO syntax |
|
Back to top |
|
|
gchitra
New User
Joined: 08 Jun 2005 Posts: 36 Location: Burtonsville, MD
|
|
|
|
Thanks Babu.
Can you please also tell me what is the correct syntax for EXECIO DISKR?
Thanks,
Chitra |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
10.3 EXECIO.
From what I can tell, if the CLIST looks like this:
Code: |
READEDSN: +
ALLOC FI(EFILEIN) DA(&SYSCAPS('&DSNIN')) SHR REUSE
OPENFILE EFILEIN INPUT
READEREC: +
IF &JOBNU > 99 THEN +
DO
WRITE LAST FILE PROCESSED WAS &CPYIN
WRITE ONLY 90 FILES CAN BE PROCESSED AT ONE TIME
WRITE PLEASE RUN REST OF THE FILES SEPARATELY
GOTO FINI
END
GETFILE EFILEIN
SET ENRCD = &NRSTR(&EFILEIN)
IF &ENRCD = &STR(ENDOFFILE) THEN GOTO ALLDONE
SET APPLID = &STR(&SUBSTR(1:3,&ENRCD)
SET CPYIN = &STR(&SUBSTR(4:50,&ENRCD)
GOTO READEREC
ALLDONE: +
CLOSFILE EFILEIN
FREE FI(EFILEIN)
WRITE ALLDONE
END
FINI: +
CLOSFILE EFILEIN
FREE FI(EFILEIN)
WRITE FINI
END
|
then an equivalant REXX exec looks something like this:
Code: |
READEDSN:
"ALLOC FI(EFILEIN) DA('"DSNIN"') SHR REUSE"
"EXECIO 0 DISKR EFILEIN"
READEREC:
IF JOBNU > 99 THEN
DO
SAY 'LAST FILE PROCESSED WAS 'CPYIN
SAY 'ONLY 90 FILES CAN BE PROCESSED AT ONE TIME'
SAY 'PLEASE RUN REST OF THE FILES SEPARATELY'
SIGNAL FINI
END
"EXECIO 1 DISKR EFILEIN"
RETCODE = RC
PARSE PULL ENRCD
IF (ENRCD = 'ENDOFFILE' | RETCODE > 0) THEN SIGNAL ALLDONE
APPLID = SUBSTR(ENRCD,1,3)
CPYIN = SUBSTR(ENRCD,4,44)
CALL READEREC
ALLDONE:
"EXECIO 0 DISKR EFILEIN (FINIS"
"FREE FI(EFILEIN)"
SAY ALLDONE
EXIT 0
FINI:
"EXECIO 0 DISKR EFILEIN (FINIS"
"FREE FI(EFILEIN)"
SAY FINI
EXIT 0
|
|
|
Back to top |
|
|
gchitra
New User
Joined: 08 Jun 2005 Posts: 36 Location: Burtonsville, MD
|
|
|
|
Thanks Superk. I think it is working now. Thanks a lot for your help. |
|
Back to top |
|
|
|