Page 1 of 1

REXX- Query..... Allocate?

PostPosted: Mon Jul 30, 2007 5:41 pm
by bodhi
hi,

could anyone please tell me How to access a data set given by a user in the REXX Program.

i am asking you this because in the REXX program we need to allocate the Dataset before processing it with EXECIO.

so i would like to know how to allocate that dataset entered by a user?


thanks
Girish Mohnani

Re: REXX- Query..... Pease answer

PostPosted: Mon Jul 30, 2007 5:55 pm
by MrSpock
What type of environment (i.e. address space) is your exec running in? Batch (MVS), TSO, TSO/ISPF, Netview, USS or some other environment?

The methods used to allocate datasets/sysout to DD's vary depending on the active environment. The only common factor is that the allocation of data is an external event to the REXX exec.

Re: REXX- Query..... Pease answer

PostPosted: Mon Jul 30, 2007 6:01 pm
by bodhi
The environment is TSO/ISPF

Re: REXX- Query..... Pease answer

PostPosted: Mon Jul 30, 2007 6:03 pm
by amitava
Hey Bondhi,
I think you want to allocate the dataset in TSO environment! So please refer the following sample -
   "ALLOC F(LOGICAL) DA('[i]<Dataset Name>[/i]') NEW DIR(10)
   SPACE(10,10)DSORG(PO) RECFM(F,B) LRECL(80) BLKSIZE(800)"
   "FREE F(LOGICAL)"


Byu this you will be able to allocate a dataset. Here it is PO i.e it is a PDS. If you want to allocate a PS, change the DSORG from PO to PS and don't give the DIR() parameter.

Regards,

Amitava

Re: REXX- Query..... Pease answer

PostPosted: Mon Jul 30, 2007 6:09 pm
by bodhi
Well i know this method of allocating but i want to access the data set which will be entered by the user after running the program


i am sending you the part of my coding as following:


SAY 'PLEASE ENTER DATA SET NAME'
PULL DATA_SET
"alloc da( ) f(indd) shr reuse"
"execio * diskr indd (stem var."


according to the coding part above what should i type in the DA( ) so that i can access the Dataset entered by the user after the execution of SAY and PULL statement.

thanks
Bodhi

Re: REXX- Query..... Pease answer

PostPosted: Mon Jul 30, 2007 6:23 pm
by MrSpock
"alloc da('"DATA_SET"') f(indd) shr reuse"

Re: REXX- Query..... Pease answer

PostPosted: Mon Jul 30, 2007 6:59 pm
by bodhi
Thank you very much MrSpock.

Re: REXX- Query..... Pease answer

PostPosted: Tue Jul 31, 2007 2:47 am
by CICS Guy
Nice Mr Spock.... :o

Re: REXX- Query..... Allocate?

PostPosted: Thu Aug 02, 2007 6:34 pm
by marso
To read from a file
InpFileName = "'prefix.input.file'"
If SYSDSN(InpFileName) <> "OK" Then Do
   Say "Input file not found"
   Return
End
"ALLOC F(INPF) DA("InpFileName") SHR"
"EXECIO * DISKR (FINIS STEM InpLines."
"FREE F(INPF)"


To write to a file:
OutFileName = "'prefix.output.file'"
If SYSDSN(OutFileName) = "OK" Then
   "ALLOC F(OUTF) DA("OutFileName") SHR"
Else
   "ALLOC F(OUTF) DA("OutFileName") NEW TRACKS SPACE(10,10) RECFM(FB) LRECL(80)"
"EXECIO * DISKW (FINIS STEM OutLines."
"FREE F(OUTF)"