[comp.lang.asm370] Writing to a CMS file

PGIFFORD@ALLEGVM.BITNET (Pete Gifford) (04/17/91)

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?

Thanks,

news@ucf1vm.BITNET (04/19/91)

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

czl30@DUTS.CCC.AMDAHL.COM (Chris Lee) (04/20/91)

Hi,

You need to code up as FSCB. Also generate a DSECT for that FSCB
using the FSCBD macro. Map this onto the FSCB, and you can store
anything in the right place!

Good luck....Chris Lee