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

Whats the assambler code for SUBSTR() in REXX?


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jackzhang75

Active User


Joined: 09 Jun 2014
Posts: 125
Location: US

PostPosted: Sat Aug 29, 2015 1:59 am
Reply with quote

Hi ,

I want to extract the Load module name from following ouput
I know in REXX i can do somthing like :
So what is the corresponding code in assambly to do that ? Thanks

Code:
DO I =1 TO UL0.0                       
 IF SUBSTR(UL0.I,1,7)='PDS232I' THEN DO
    IF SUBSTR(UL0.I,9,4) <>'NAME' THEN 
       QUEUE SUBSTR(UL0.I,8,8)         
 END                                   
END         



Code:
PDS300A ENTER OPTION -- DSN=TTAD.TSP.PCAS9
   ATTRIB * SHORT                         
PDS232I NAME     ALIASOF   CREATED  SIZE S
PDS232I @ZE01    CCS@ZE01 15/08/26  102K 0
PDS232I CAILPAM           15/08/26  8584 0
PDS232I CAMCRCVY          15/08/26 16552 0
PDS232I CAMSADRV          15/08/26  2648 0
PDS232I CASHCASI          15/08/26  6704 0
PDS232I CASRVASI          15/08/26  3672 0
PDS232I CASRVCMD          15/08/26 20616 0
PDS232I CAS9SAFC          15/08/26 10200 0
PDS232I CAUNZIP           15/08/26 27072 0
PDS232I CCS@ZE01          15/08/26  102K 0
PDS232I LXCFMAIN          15/08/26 24624 0
                                         
PDS118I 3 MEMBERS RMODE24; SIZE IS 43K   
PDS119I 7 MEMBERS RMODEANY; SIZE IS 177K 
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1315
Location: Vilnius, Lithuania

PostPosted: Sat Aug 29, 2015 4:04 am
Reply with quote

Just as simple as REXX:

Code:
 CMP with 'PDS232I'
 JNE quit

 CMP with 'NAME'
 JNE quit

 "process"

quit
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Sat Aug 29, 2015 6:31 am
Reply with quote

Actually, this is a silly request. Most Assembler programmers would just read the PDS directory directly, not mess around with getting a directory listing and then checking the listing.
Code:
         OPEN  (DIR,INPUT)
DIR0100  GET   DIR
         LH    5,0(,1)
         AR    5,1
         BCTR  5,0
         LA    3,2(,1)
         USING PDS2,3
DIR0200  CLC   =FL8'-1',PDS2NAME
         BE    EOF
         CLC   =CL8'xxx',PDS2NAME
         BNE   DIR0300
         ...   Process the directory entry
DIR0300  IC    4,PDS2INDC
         N     4,=A(PDS2LUSR)
         LA    4,(PDS2USRD-PDS2)(4,4)
         BXLE  3,4,DIR0200
         B     DIR0100
EOF      ...
         ...
DIR      DCB   DSORG=PS,MACRF=GL,DDNAME=...,EODAD=EOF,
               RECFM=F,LRECL=256,BLSIZE=256
         ...
         IHAPDS PDSBLDL=NO
The IHAPDS macro is in SYS1.MODGEN, and has all the standard symbols for load module entries.

In the code, reg 3 points to the current directory entry, and register 5 points to the last used data byte in the directory block. The code starting at DIR0300 computes the length of the directory entry. The 5 low order bits in PDS2INDC define the number of 2 byte elements of user data in the directory entry. LA 4,(PDS2USRD-PDS2)(4,4) takes this value, multiplies it by 2, and adds the length of the member name and TTRC data areas to get the complete length of the directory entry.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Mon Aug 31, 2015 4:48 am
Reply with quote

A more direct answer to the original query.
  • Prepare a DSECT that defines the record contents and use the DSECT.
    Code:
    INREC    DSECT
    MSGID    DS    C'PDS232I',C
    MODNAME  DS    CL8,C
    ALIASOF  DS    CL8,C
    MDATE    DS    C'YY/MM/DD',C
    MSIZE    DS    CL5

    LOOP     GET   INPUT
             USING INREC,1
             CLC   MSGID,=C'PDS232I'
             BNE   LOOP
             ...
             B     LOOP
    In this snippet, the DCB used to read the input data set is defined as using “locate” mode I/O, wheret the GET macro returns a record address to your program in reg 1. This scheme works well only if the input data is more or less fixed.

  • Examine the data more directly.
    Code:
    LOOP     GET   INPUT
             CLC   =C'PDS232I',0(1)
             BNE   LOOP
             ...
             B     LOOP
    As in the first snippet, the GET macro returns a record address in reg 1. This scheme is more useful if the record contents are more vaiable.
Jack, before you go any further:

Go to the blackboard and write

Assembler is not a high level language.

100 times. Then write

Assembler is not Rexx.

100 times.
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 -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts purge jobs with return code 0 and ret... JCL & VSAM 4
No new posts Run rexx with JCL Job CLIST & REXX 1
No new posts Run rexx in batch job CLIST & REXX 7
No new posts Does anyone know rexx for VSE CLIST & REXX 3
No new posts TSO ALLOC In REXX Needs Improvement JCL & VSAM 3
Search our Forums:

Back to Top