Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

NRSTR in CLIST

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: NRSTR in CLIST
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: 8593
Location: Back in jolly old England

PostPosted: Mon Feb 23, 2009 8:44 pm    Post subject:
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    Post subject:
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    Post subject:
Reply with quote

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

Site Director


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

PostPosted: Wed Feb 25, 2009 1:00 am    Post subject:
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    Post subject: Reply to: NRSTR in CLIST
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: 401
Location: Mumbai

PostPosted: Wed Feb 25, 2009 7:42 am    Post subject: Reply to: NRSTR in CLIST
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    Post subject:
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

Moderator Team Head


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

PostPosted: Fri Feb 27, 2009 1:42 am    Post subject: Reply to: NRSTR in CLIST
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Convert CLIST to REXX cvnlynn CLIST & REXX 12 Tue Jun 27, 2017 2:06 am
No new posts Trace in CLIST PANEL cvnlynn CLIST & REXX 1 Thu Jun 22, 2017 11:06 pm
No new posts What is the code in CLIST to enable t... jackzhang75 CLIST & REXX 1 Fri Dec 02, 2016 3:02 am
No new posts how to find clist's or view library Andrew Hsia CLIST & REXX 4 Tue Jun 28, 2016 6:07 pm
No new posts 2 same CLIST pgm but with different n... boyti ko CLIST & REXX 5 Fri Jun 03, 2016 4:55 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us