|
|
| Author |
Message |
sinusam
New User
Joined: 06 Jan 2004 Posts: 18
|
|
|
|
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 |
|
 |
References
|
|
 |
somasundaran_k
Active User
Joined: 03 Jun 2003 Posts: 141
|
|
|
|
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 ..
| 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 |
|
 |
somasundaran_k
Active User
Joined: 03 Jun 2003 Posts: 141
|
|
|
|
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 )
| Quote: |
-----------------------------------------------------------5----+----6----+----7--
INDCB DCB DSORG=PS,MACRF=(GM),DDNAME=SYSIN,EODAD=FINISH, X
|
Regds
-Som |
|
| Back to top |
|
 |
sinusam
New User
Joined: 06 Jan 2004 Posts: 18
|
|
|
|
Dear Somu,
U R Great.. Thanks!!! for the source code.. Lemme try to compile.. |
|
| Back to top |
|
 |
lapkow
New User
Joined: 17 Oct 2006 Posts: 1
|
|
|
|
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 |
|
 |
|
|
|