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
 

 

Sequential file access in Assembler (HLASM)

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

New User


Joined: 06 Jan 2004
Posts: 18

PostPosted: Thu Apr 28, 2005 9:05 pm    Post subject: Sequential file access in Assembler (HLASM)
Reply with quote

How to READ / WRITE sequential files in Assembler ?

I tried to do it with DCB macro, but found lot of problems. Shall i set the AMODE, RMODE to 24? what DCB options should i specify ?

Any sites available with sample programs ?

Rgds,
Sinu
Back to top
View user's profile Send private message

somasundaran_k

Active User


Joined: 03 Jun 2003
Posts: 134

PostPosted: Sat Apr 30, 2005 12:31 am    Post subject:
Reply with quote

Sinu
Here is a sample program that will read an input file and write into another one. I have not provided any file handling or error handling. Just GET and PUT. Also note that this program will return a return code
0 in all codition since I'm initialising R(15).

Anyway here is something to start with .. icon_lol.gif
Code:

FILEASM  CSECT                   
         STM 14,12,12(13)       
         BALR 12,0               
         USING *,12             
         ST 13,SAVE+4           
         LA 13,SAVE             
         OPEN (INDCB,(INPUT))   
         OPEN (OUTDCB,(OUTPUT)) 
IOLOOP   MVC INAREA,=80C' '     
         GET INDCB,INAREA       
         MVI OUTCARR,C' '       
         MVC OUTLINE(80),INAREA 
         PUT OUTDCB,OUTAREA     
         B IOLOOP               
FINISH   CLOSE (INDCB)           
         CLOSE (OUTDCB)         
EXIT     L 13,SAVE+4             
         LM 14,12,12(13)         
         XR 15,15                                                       
         BR 14                                                         
INDCB    DCB DSORG=PS,MACRF=(GM),DDNAME=SYSIN,EODAD=FINISH,                                                X
               RECFM=FB,LRECL=80,BLKSIZE=0                             
OUTDCB   DCB DSORG=PS,MACRF=(PM),DDNAME=OUTPUT,                                                            X
               RECFM=FBA,LRECL=133,BLKSIZE=0                           
INAREA   DS CL80                                                       
OUTAREA  DS 0CL133                                                     
OUTCARR  DC CL1' '                                                     
OUTLINE  DC CL132' '                                                   
SAVE     DS 18F                                                         
         END                                                           


You don't have to specify RMODE to 24. You can specify AMODE(31),RMODE(ANY). Go thru the manual for more details.

hth
-Som
Back to top
View user's profile Send private message
somasundaran_k

Active User


Joined: 03 Jun 2003
Posts: 134

PostPosted: Sat Apr 30, 2005 12:41 am    Post subject:
Reply with quote

Oops..
Alignment problem in INDCB and OUTDCB.

Please note that the continuation X should be in the 72nd column.

like (hope this will come correct icon_lol.gif )

Quote:

-----------------------------------------------------------5----+----6----+----7--
INDCB DCB DSORG=PS,MACRF=(GM),DDNAME=SYSIN,EODAD=FINISH, X


Regds
-Som
Back to top
View user's profile Send private message
sinusam

New User


Joined: 06 Jan 2004
Posts: 18

PostPosted: Sat Apr 30, 2005 10:08 pm    Post subject:
Reply with quote

Dear Somu,

U R Great.. icon_biggrin.gif Thanks!!! for the source code.. Lemme try to compile..
Back to top
View user's profile Send private message
lapkow

New User


Joined: 17 Oct 2006
Posts: 1

PostPosted: Tue Oct 17, 2006 3:31 am    Post subject: Re: Sequential file access in Assembler (HLASM)
Reply with quote

I have a follow-up question:

I take the above program and assemble/link it in the unix enviroment.
How do I specify the in and out DD statements to the program trying
to invoke it from the unix environment.

Chris
Back to top
View user's profile Send private message
cchidhu

New User


Joined: 18 Aug 2007
Posts: 4
Location: India

PostPosted: Fri Feb 27, 2009 12:23 pm    Post subject:
Reply with quote

Dear Somu,
If you have document with you then share it here. It will be more helpful
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7996
Location: Bellevue, IA

PostPosted: Fri Feb 27, 2009 4:18 pm    Post subject:
Reply with quote

Quote:
ou don't have to specify RMODE to 24. You can specify AMODE(31),RMODE(ANY).
Have you actually tried this? I've had to use DCBE to get 31-bit addressability for the DCB; otherwise the DCB macro forces you into 24-bit mode.
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 755
Location: Germany

PostPosted: Fri Feb 27, 2009 4:50 pm    Post subject:
Reply with quote

Hi !

Right Robert !

Or you use the AMODE=24,RMODE=24 for compile and link and within the programm you switch to 31-BitMode before the Dataset operation.

Compile/Link:

LET,LIST,XREF,NCAL,AMODE=24,RMODE=24'

DCB-Definition:

S3FILE_DCB DCB

DDNAME=S3DAT,DSORG=PS,MACRF=PM,DCBE=S3FILE_DCBE
S3FILE_DCBE DCBE RMODE31=BUFF

Dataset operation:

CHGAMODE 31,R14

USING IHADCB,R4
L R4,=A(S3FILE_DCB)

MVC S3JCLNAM,DCBDDNAM

IF DCBOFLGS,Z,DCBOFOPN,TM
OPEN ((R4),OUTPUT)
EIF
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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 3 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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