To continue learning, remove parameters from the input DCB one at a time starting w/BLKSIZE. Then do LRECL, RECFM, DSORG. They aren't necessary for input files.
You could then read about the DCBD macro. You could use it to remove BLKSIZE, LRECL, RECFM from the output DCB: - open the input - copy the fields underlying the parameters - open the output Then read about DCB exit ... IBM Mainframe Assembler List <[email protected]> wrote on 12/08/2011 09:20:35 AM: > From: Lindy Mayfield <[email protected]> > To: [email protected] > Date: 12/08/2011 09:25 AM > Subject: Assembler pgm to copy a file > Sent by: IBM Mainframe Assembler List <[email protected]> > > There was a kinda-sorta challenge for me to write the most basic > assembler program to copy a file. Since I am no assembler > programmer by any means, it of course took me some time to get it > done. Also I had no clue where to start. I'd say all total about 5 > hours to get it finished. This included reading docs, books, etc., > coding and debugging. And false starts. > > You can imagine my immediate frustration when I went off into the > EXCP world (by accident). Then I cheated a little bit and had a > peek at George Struble's _Assembler Language Programming for The > IBM System/370 Family_. The 3rd edition printed 1984, 1st in 1964. > > Then I found myself in the QSAM arena, and after that it was quite > easy. Here is my PGM and the two biggest problems I had: > > COPYFILE START 0 > YREGS > COPYFILE CSECT , > COPYFILE AMODE 24 > COPYFILE RMODE 24 > DS 0H > BAKR R14,0 Save caller's ARs and GPRs > LR R12,R15 Set up 1st base register > USING COPYFILE,R12 and inform assembler > OPEN (DCBIN1,(INPUT),DCBOUT1,(OUTPUT)) > LOOP DS 0H > GET DCBIN1,INOUTBUF > PUT DCBOUT1,INOUTBUF > B LOOP > EOF DS 0H no more records > CLOSE (DCBIN1,,DCBOUT1) > XR 15,15 > PR , > > DCBIN1 DCB BLKSIZE=80,DDNAME=INPUT,RECFM=FB,LRECL=80,DSORG=PS, X > EODAD=EOF,MACRF=GM > DCBOUT1 DCB BLKSIZE=80,DDNAME=OUTPUT,RECFM=FB,LRECL=80,DSORG=PS, X > MACRF=PM > INOUTBUF DS CL80 Input/Output Storage Area > END , > > > Notes: > 1. That EODAD is nice. As a matter of fact, this looks strangely a > lot like a Cobol program. I can almost see where Grace got her inspiration. > 2. Those horrible S0C4's. First one was a S0C4-10, unknown module, > and happened on the OPEN. How could I have debugged this? The > problem that I found from reading (yes reading the docs, I do) the > docs carefully, was that DCB's have to be in 24 bit mode storage. > Whoops. Where (and what kind of) in the dump would show that information? > 3. A S0C4-11 because I coded an MVC incorrectly. I coded this: > MVC INOUTBUF(80),=C'Test record' > INOUTBUF DS CL80 > A change to MVC INOUTBUF(11),='Test record' works just fine. > I cheated on this one, too. I wasn't able to tell the problem > in the dump. The dump told me it was the MVC instruction that was > wrong, so I just guessed that it was because the MVC wasn't correct. > 4. The MACRF options need to be correct, but the assembler warned > me about those. The docs showed all the options, not just QSAM, so > I got them mixed up a little. And I still need to know what MF=T > means. The book just says "watch this one." I guess in 1969, that > was enough. ----------------------------------------- The information contained in this communication (including any attachments hereto) is confidential and is intended solely for the personal and confidential use of the individual or entity to whom it is addressed. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this communication in error and that any review, dissemination, copying, or unauthorized use of this information, or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. Thank you
