As he used BAKR/PR, GET/PUT will safely use the callers savearea. On Thu, 8 Dec 2011 15:00:23 +0000 Bodoh John Robert <[email protected]> wrote:
:>No save area? GET and PUT need a save area. :> :> :>John :> :> :>-----Original Message----- :>From: IBM Mainframe Assembler List [mailto:[email protected]] On Behalf Of Lindy Mayfield :>Sent: Thursday, December 08, 2011 9:21 AM :>To: [email protected] :>Subject: Assembler pgm to copy a file :> :>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. -- Binyamin Dissen <[email protected]> http://www.dissensoftware.com Director, Dissen Software, Bar & Grill - Israel Should you use the mailblocks package and expect a response from me, you should preauthorize the dissensoftware.com domain. I very rarely bother responding to challenge/response systems, especially those from irresponsible companies.
