🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.asm370
Article #706

Re: Writing to a CMS file

#706
From: news
Date: Thu, 18 Apr 1991 17:00
71 lines
3821 bytes
In article <9104171945.AA06741@ucbvax.Berkeley.EDU>, PGIFFORD@ALLEGVM.BITNET
(Pete Gifford) says:
>
>This is my first serious attempt at a writing a CMS assembler program.  I want
>to be able to create to a file whose name is given as a parameter to the
>program.  It seems that the FSCB macro requires that the filename be given in
>quotes.  Since I won't know the filename at assembly time, how do I make this
>generic?
>
>My first idea is to code the macro with a dummy name and then insert the real
>name into the proper location once I have gotten it.  Am I on the right track?
>Anybody have code they are willing to share?

More or less. Use the FSCBD macro to map the DSECT, then overwrite the
filename. I code '* * *' in the FSCB macro when I know I'm going to overwrite
the filename.

Here's an example. To run it, type 'TEST xxx' and it will write out a one
line file called 'xxx OUTPUT'.

**************************************************************
**  TEST - Test Program                                     **
**************************************************************
TEST     CSECT
         STM   R14,R12,12(R13)    Save Registers
         LR    R12,R15            Load Base Register
         USING TEST,R12           Establish Addressability
         BAL   R15,SAVEAREA+72    R15 --> New Savearea
SAVEAREA DS    18F
         ST    R13,4(R15)         Save --> Caller's Savearea
         ST    R15,8(R13)         Save --> Our Savearea
         LR    R13,R15            Load Address of our Savearea
         SPACE ,
**************************************************************
**  Write one line to specified output file                 **
**************************************************************
         SPACE ,
         LR    R9,R1              R9 --> Command Line Buffer
         LA    R10,OUTFSCB        Address output FSCB
         USING FSCBD,R10          Map out the FSCB contents
         MVC   FSCBFN,8(R9)       First token is filename
         FSWRITE FSCB=(R10)       Write line to output file
         FSCLOSE FSCB=(R10)       Close the output file
         SPACE ,
**************************************************************
**  Return to Caller                                        **
**************************************************************
         SPACE ,
RETURN   L     R13,4(R13)         Restore Caller's R13
         L     R14,12(R13)        Restore Caller's R14
         LM    R0,R12,20(R13)     Restore Caller's R0-R12
         BR    R14                Return to Caller
         SPACE ,
**************************************************************
**  Data Area                                               **
**************************************************************
         SPACE ,
OUTFSCB  FSCB  '* OUTPUT A',RECFM=F,BSIZE=80,BUFFER=OUTBUFF
OUTBUFF  DC    CL80'This is the output file'
         LTORG  ,
         REGEQU ,
         FSCBD ,
         END

- jms

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
John Schulien   (U21187@UICVM.UIC.EDU or U21187@UICVM.BITNET)
The University of Illinois At Chicago   ICBM: 41 52 N 87 40 W
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Amalgamated Interkludge       Solutions that work for a while
Technical Details
Message-ID: <9104190126.AA00800@ucbvax.Berkeley.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!rphroy!caen!uwm.edu!bionet!agate!ucbvax!ucf1vm.BITNET!news

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!rphroy!caen!uwm.edu!bionet!agate!ucbvax!ucf1vm.BITNET!news
From: news@ucf1vm.BITNET
Newsgroups: comp.lang.asm370
Subject: Re: Writing to a CMS file
Message-ID: <9104190126.AA00800@ucbvax.Berkeley.EDU>
Date: 18 Apr 91 17:00:03 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Reply-To: IBM 370 Assembly Programming Discussion List
              <ASM370@OHSTVMA.BITNET>
Distribution: inet
Organization: The Internet
Lines: 71