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
 

 

Whats the assambler code for SUBSTR() in REXX?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
jackzhang75

Active User


Joined: 09 Jun 2014
Posts: 106
Location: windsor

PostPosted: Sat Aug 29, 2015 1:59 am    Post subject: Whats the assambler code for SUBSTR() in REXX?
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

Active Member


Joined: 07 Feb 2009
Posts: 984
Location: Oostende, Belgium

PostPosted: Sat Aug 29, 2015 4:04 am    Post subject:
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 User


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

PostPosted: Sat Aug 29, 2015 6:31 am    Post subject:
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 User


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

PostPosted: Mon Aug 31, 2015 4:48 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts PL/I code tuning/Performance improvement Virendra Shambharkar PL/I & Assembler 4 Mon Dec 05, 2016 11:57 am
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 IDEAL - Code Retrieval yugendran CA Products 0 Fri Nov 25, 2016 3:27 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm


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