IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

NRSTR in CLIST


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
gchitra

New User


Joined: 08 Jun 2005
Posts: 36
Location: Burtonsville, MD

PostPosted: Mon Feb 23, 2009 8:38 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Mon Feb 23, 2009 8:44 pm
Reply with quote

What does the NRSTR function do ?
Back to top
View user's profile Send private message
gchitra

New User


Joined: 08 Jun 2005
Posts: 36
Location: Burtonsville, MD

PostPosted: Mon Feb 23, 2009 9:06 pm
Reply with quote

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
View user's profile Send private message
gchitra

New User


Joined: 08 Jun 2005
Posts: 36
Location: Burtonsville, MD

PostPosted: Wed Feb 25, 2009 12:15 am
Reply with quote

Can anyone please help me with this?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Feb 25, 2009 1:00 am
Reply with quote

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
View user's profile Send private message
gchitra

New User


Joined: 08 Jun 2005
Posts: 36
Location: Burtonsville, MD

PostPosted: Wed Feb 25, 2009 1:21 am
Reply with quote

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
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 400
Location: Mumbai

PostPosted: Wed Feb 25, 2009 7:42 am
Reply with quote

The problem isn't &NRSTR... read up in EXECIO syntax
Back to top
View user's profile Send private message
gchitra

New User


Joined: 08 Jun 2005
Posts: 36
Location: Burtonsville, MD

PostPosted: Wed Feb 25, 2009 7:28 pm
Reply with quote

Thanks Babu.

Can you please also tell me what is the correct syntax for EXECIO DISKR?

Thanks,
Chitra
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Fri Feb 27, 2009 1:42 am
Reply with quote

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
View user's profile Send private message
gchitra

New User


Joined: 08 Jun 2005
Posts: 36
Location: Burtonsville, MD

PostPosted: Tue Mar 03, 2009 8:37 pm
Reply with quote

Thanks Superk. I think it is working now. Thanks a lot for your help.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
No new posts Same command as on commandline in REX... TSO/ISPF 6
No new posts clist to rexx converter CLIST & REXX 2
No new posts Is there a way to determine Clist usa... CLIST & REXX 10
No new posts REXX/CLIST tool for BCSR and EDSR CLIST & REXX 2
Search our Forums:

Back to Top