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

Using DSECT - for file reading


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
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
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 Member


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

PostPosted: Mon Nov 17, 2014 11:43 pm
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: 2481
Location: Netherlands, Amstelveen

PostPosted: Tue Nov 18, 2014 2:05 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top