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
 

 

Using DSECT - for file reading

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

New User


Joined: 12 Nov 2014
Posts: 4
Location: USA

PostPosted: Mon Nov 17, 2014 10:09 pm    Post subject: Using DSECT - for file reading
Reply with quote

Hi,

Here is my 'simplified' program that works perfectly fine for reading a BSAM file.
Code:
...
...
         OPEN  (INPUTF,INPUT)                       
         OPEN  (OUTPUTF,OUTPUT)                     
LOOP     READ  DECB1,SF,INPUTF,CARD                 
         CHECK DECB1                                 
         LH    R1,(DCBBLKSI-IHADCB)+INPUTF           
         L     15,(DECIOBPT-DECB)+DECB1             
         LH    R0,14(,R15)                           
         SR    R1,R0                                 
         STH   R1,(DCBBLKSI-IHADCB)+OUTPUTF         
         WRITE DECB2,SF,OUTPUTF,CARD                 
         CHECK DECB2                                 
         B     LOOP                                 
ABTERM   WTO   'THE PROGRAM ABENDED'                 
NOMORE   WTO   'END OF FILE REACHED'                 
         CLOSE INPUTF                               
         CLOSE OUTPUTF                               
...
...
INPUTF   DCB   DDNAME=INPUTFL,                                         X
               MACRF=(R),                                              X
               DSORG=PS,                                               X
               LRECL=80,                                               X
               BLKSIZE=4560,                                           X
               RECFM=FB,                                               X
               EODAD=NOMORE,                                           X
               SYNAD=ABTERM                                             
OUTPUTF  DCB   DDNAME=OUTPUTFL,                                        X
               MACRF=(W),                                              X
               DSORG=PS,                                               X
               LRECL=80,                                               X
               BLKSIZE=4560,                                           X
               RECFM=FB,                                               X
               SYNAD=ABTERM                                             
SAVEAREA DS    18F                                                     
CARD     DS    CL4560                                                   
         IHADECB DSECT=YES                                             
         DCBD  DSORG=PS,DEVD=DA                                         
* REGISTER EQUATES                       



Now, I'm trying to use DSECT to modify the same program.

Here is my DSECT definition:
Code:
DATA     DSECT           
CARD     DS    CL160     
@DATA    EQU   *-DATA     

and here is the part of the program that I've modified accordingly. Everything else remains the same.
I've also removed some lines for simplicity.


Code:
         OPEN  (INPUTF,INPUT)                         
         OPEN  (OUTPUTF,OUTPUT)                       
         USING DATA,R8                                 
         LA    R0,@DATA                               
         GETMAIN RC,LV=(0),SP=0,LOC=24,BNDRY=PAGE     
         LR    R8,R1                                   
LOOP     READ  DECB1,SF,INPUTF,CARD                   
         CHECK DECB1                                   
         WRITE DECB2,SF,OUTPUTF,CARD                   
         CHECK DECB2                                   
         B     LOOP                                   
ABTERM   WTO   'THE PROGRAM ABENDED'                   
NOMORE   WTO   'END OF FILE REACHED'                   
         CLOSE INPUTF                                 
         CLOSE OUTPUTF             



howeverm when i execute this program, i'm geting a MAXCC = 08 in assembly with the below error.
Code:

000054 00000000                      49+         DC    A(CARD)             ADDR
** ASMA032E Relocatable value or unresolved symbol found when absolute value req
** ASMA435I Record 323 in SYS1.MACLIB(IHBRDWRS) on volume: R1130A               
000058 00000000                      50+         DC    A(0)                ADDR


If i remove CARD and insert the direct address, like 0(,R8) or 0(R8), I get the following error:
Code:
000054                               49+         DC    A(0(R8))            ADDR
** ASMA035S Invalid delimiter - 0(R8)                                           
** ASMA435I Record 323 in SYS1.MACLIB(IHBRDWRS) on volume: R1130A               
000054 00000000                      50+         DC    A(0)                ADDR


Could someone please help me in understanding where am i going wrong, in using DSECT.

Code'd
Back to top
View user's profile Send private message

steve-myers

Active User


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

PostPosted: Mon Nov 17, 2014 11:43 pm    Post subject:
Reply with quote

You should be able to figure out the ASMA032E error all by your little self.

The ASMA035S error is more complicated. Basically, you have two methods.

The first one goes back to the BSAMRW method in your first thread. You have to store the address directly in the DECB before you run the READ macro as in my little example.

The other method is to use a "remote" DECB.

READ RMDECB,SF,,(R8),MF=E
...
READ RMDECB,SF,DCB,*-*,'S',MF=L

Unfortunately the READ/WRITE macros are sort of non-standard in how to specify and use a remote DECB. It comes about because the regular READ/WRITE macros build the DECB as part of the macro expansion and the addresses must be specified as a true address constant. In the first READ statement, when you specify MF=E you are telling the macro to prepare a remote DECB - that is a DECB that is not part of the macro - at address RMDECB. In the second READ statement you are saying prepare a DECB without the code to execute the read write function, and assign it label RMDECB.

The issue about inline data, as in the the DECB data area in the "standard" READ/WRITE macros versus the use of a remote DECB created using the MF=L specification of the READ/WRITE macros is more complex. Current programming practice discourages the use of data areas mixed in with code. In some cases there are performance issues. This was especially true with the first generation of z/Architecture mainframes. The situation was so smelly some customers told IBM to take first generation z/Architecture machines back rather than correct their own crummy programs! Not only that, but by definition, code using inline DECBs is not reenterable. So, learn how to use remote parameter lists.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2422
Location: Netherlands, Amstelveen

PostPosted: Tue Nov 18, 2014 2:05 pm    Post subject:
Reply with quote

Did you specify the area address as (R8), if not try that.
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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