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

Using ISREDIT to read the whole member into a stem variable


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

Active User


Joined: 01 Dec 2006
Posts: 144
Location: Mumbai

PostPosted: Thu Jul 31, 2008 9:27 am
Reply with quote

Currently I am writing a utility to read the whole JCL member into a stem variable using the following-

Code:
 DROP PDFLT_LINE.                                     
 JCLIN = 'CNC20.TEST.JCL(TSTRUN)'                     
 "ALLOC FI(INSKEL) DA('"||JCLIN||"') SHR"             
 "EXECIO * DISKR INSKEL (STEM PDFLT_LINE. FINIS"       
 "FREE FI(INSKEL)"                                     


Can anybody tell me how I can do this by ISREDIT by typing the macro in my JCL member so that all the lines of JCL member get copied into stem variable?
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Thu Jul 31, 2008 11:54 am
Reply with quote

And what do you want to do with the stem variables afterwards ?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jul 31, 2008 12:19 pm
Reply with quote

no answer from the OP.


niks_jude,

what do you want to do with the member contents?

Why put it into a stem variable (other than the fact you have already coded it - which obviously precludes any changes...)?
Back to top
View user's profile Send private message
niks_jude
Warnings : 1

Active User


Joined: 01 Dec 2006
Posts: 144
Location: Mumbai

PostPosted: Thu Jul 31, 2008 12:40 pm
Reply with quote

This is my REXX. I read all the lines of JCL member - CNC20.TEST.JCL(TSTRUN) in the stem variable and do my operation on all the lines. What I want now is just type the macro in the JCL member in view mode and read it and do the operation. This will add flexibility and I do not have to modify the REXX for different datasets and/or members.


Code:
  PARSE SOURCE . . MYNAME .             /* GET PROGRAM NAME           */
  EXIT_RC = 0                           /* INITIALIZE RETURN CODE     */
/*SIGNAL ON HALT        */                                             
/*SIGNAL ON SYNTAX      */                                             
                                                                       
  GDSNOTFOUND = "DATASET NOT FOUND"                                     
  GMEMNOTFOUND = "MEMBER NOT FOUND"                                     
                                                                       
  CALL CONVERTPDF                                                       
                                                                     
  EXIT                                                               
                                                                     
CONVERTPDF:                                                             
/* E = OUTTRAP ('OFF')    */                                           
   X = SYSDSN("'CNC20.TEST.JCL(TSTRUN)'")                               
   IF X = GMEMNOTFOUND THEN DO                                         
      SAY "MEMBER NOT FOUND"                                           
      RETURN                                                           
   END                                                                 
                                                                       
    DROP PDFLT_LINE.                                                   
    JCLIN = 'CNC20.TEST.JCL(TSTRUN)'                                   
    "ALLOC FI(INSKEL) DA('"||JCLIN||"') SHR"                           
    "EXECIO * DISKR INSKEL (STEM PDFLT_LINE. FINIS"                     
    "FREE FI(INSKEL)"                                                   
    CALL QUEUEEDITCOMMANDS                                             
    RETURN                                                             
QUEUEEDITCOMMANDS:                                                     
 DROP PDFOUT_LINE.                                                     
 DO J = 1 TO PDFLT_LINE.0                       
   DSNPOS = POS('DSN=',PDFLT_LINE.J)             
   IF DSNPOS /= 0 THEN DO                       
     TEMP1 = SUBSTR(PDFLT_LINE.J,DSNPOS+4)       
     COMAPOS = POS(",",TEMP1)                   
     IF COMAPOS /= 0 THEN DO                     
       TEMP2 = SUBSTR(TEMP1,1,COMAPOS-1)         
       TEMP2 = "'"STRIP(TEMP2)"'"               
       SAY  TEMP2         /*   DEBUG  */         
       X = LISTDSI(TEMP2 NORECALL)               
       SAY X              /*   DEBUG  */         
       IF X = 0 THEN DO                         
         COMEOUT = '0'                           
         SAMELINE = J                           
         J = J - 1                               
         DO UNTIL COMEOUT = '1'                 
           J = J + 1                                     
           DISPPOS = POS("DISP=(",PDFLT_LINE.J)           
           IF DISPPOS /= 0 THEN DO                       
             TEMP3 = SUBSTR(PDFLT_LINE.J,DISPPOS+6,3)     
             COMEOUT = '1'                               
             IF TEMP3 = 'NEW' THEN DO                     
               SAY 'TEMP2'                               
             END                                         
           END  /* DISPOS IF END */                       
           ELSE DO                                       
             IF J > SAMELINE THEN DO                     
               DDPOS = POS(" DD ",PDFLT_LINE.J)           
               EXECPOS = POS(" EXEC ",PDFLT_LINE.J)       
               IF (DDPOS /= 0 | EXECPOS /=0) THEN DO     
                 IF (DDPOS /= 0) THEN DO                 
                    J = J - 1                             
                 END /* SINGLE DDPOS IF END */       
                 COMEOUT = '1'                       
               END /*DDPOS AND EXECPOS IF END */     
             END /* SAMELINE CHECK END */             
           END /* DISPOS ELSE END */                 
         END /* DO LOOP END */                       
       END /* MEMBER NOT FOUND END */                 
     END  /* COMMA POS END */                         
   END  /* DSNPOS END */                             
 END    /* DO END    */                               
          RETURN                                     
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Thu Jul 31, 2008 9:54 pm
Reply with quote

See the ISPF Edit manual, here:
ISPF online manuals.

Read about the LINE macro command, as well as the .zfirst and .zlast labels. You can write a loop that gets one line at a time.

Back to top
View user's profile Send private message
niks_jude
Warnings : 1

Active User


Joined: 01 Dec 2006
Posts: 144
Location: Mumbai

PostPosted: Fri Aug 01, 2008 6:26 pm
Reply with quote

I could not understand how to increase the line numbers?
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Fri Aug 01, 2008 10:35 pm
Reply with quote

See the ISPF Edit manual, here:
ISPF online manuals.

Read about LOCATE and CURSOR

1. locate the last line
2. use cursor to get line number
3. use DO loop to process each line.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sun Aug 03, 2008 12:38 am
Reply with quote

what about something like...

Code:
ISREDIT (first) = LINENUM .zfirst
ISREDIT (last) = LINENUM .zlast
i = 0
do linenum = first to last
    i = i + 1
    ISREDIT (temp) = LINE linenum
    line.i = temp
end
line.0 = i


the stem line. will contain all the lines of the thing being edited
line.0 will hold the count
Back to top
View user's profile Send private message
niks_jude
Warnings : 1

Active User


Joined: 01 Dec 2006
Posts: 144
Location: Mumbai

PostPosted: Mon Aug 04, 2008 11:44 am
Reply with quote

It is what I was looking for thanks
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 Error to read log with rexx CLIST & REXX 11
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Random read in ESDS file by using RBA JCL & VSAM 6
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts VSAM return code 23 - for a Random read COBOL Programming 4
Search our Forums:

Back to Top