Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Write dataset

Status
Not open for further replies.

tatoriver

Programmer
Mar 23, 2009
27
US
Hello, I am trying to write into a dataset with a rexx program.

Code:
/* REXX */
"ALLOC SHR FILE(OUT) DATASET('P1IXF2.PRIVADA.LIBRERIA(PROYEC3)')"
SAY 'ALLOC RC ' RC
OUT.1 = "   01 WS-GRUPO-VARIABLES. "
OUT.2 = "05 WS-TEXTVAR P    A BLA'."
OUT.3 = " 05 WS-NUMVAR-PACKUE 5."
OUT.4 = "05 WS-SUBGRUPO."
OUT.5 = " 10 WS-NUMVAR-ZONE   PIC      9(8)."
OUT.6 = " 10 WS-NUMVAR-ZONE     PIC      9(8)."
SAY 'VARS  RC ' RC
"EXECIO * DISKW OUT (STEM OUT."
SAY 'DISKW RC ' RC
"FREE FILE(OUT)"
SAY 'FREE  RC ' RC

And i am having the following error
Code:
ALLOC RC  0,
VARS  RC  0,
DISKW RC  0,
IKJ56861I  FILE OUT NOT FREED, DATA SET IS OPEN,
FREE  RC  12,
***,

What could be the problem? thanks in advanced Ignacio
 
Many problems... I made my changes in lower-case:

Code:
"ALLOC SHR FILE(OUT) DATASET('P1IXF2.PRIVADA.LIBRERIA(PROYEC3)')  reuse"
The second time you run this, File(OUT) will still be allocated and this ALLOC will fail unless you specify "REUSE".

Code:
"EXECIO 6 DISKW OUT (STEM OUT. finis"
The program has no idea what "*" means in this context because of the way you loaded stem OUT. It is always better, in any case, to specify how many lines are to be written. You should never "EXECIO * DISKW". To close the file after writing, specify "FINIS"


Frank Clarke
--America's source for adverse opinions since 1943.
 
That solve the problem but i would like to write append into the dataset any time i call that routine, doing like that it only write into the dataset the first time.

thanks
 
Code:
"ALLOC mod FILE(OUT) DATASET('P1IXF2.PRIVADA.LIBRERIA(PROYEC3)')  REU"

Frank Clarke
--America's source for adverse opinions since 1943.
 
still not work, here i leave you the code so you could udnerstand better me issue.

program
Code:
/* REXX */
pull line_in
COUNT=1
DO WHILE COUNT <= 3
CALL TST3 line_in
COUNT=COUNT+1
END

routine tst3
Code:
/* REXX */
PARSE ARG line_in
PARSE VALUE LINE_IN WITH NUMERO VARNAME
out.0=2
out.1=numero
out.2=varname
"ALLOC MOD SHR FI(OUT) DA('P1IXF2.PRIVADA.LIBRERIA(PROYEC3)') REUSE"
"EXECIO" OUT.0 "DISKW OUT (STEM OUT. FINIS"
"FREE FILE(OUT)"

The issue is that when the routine is call for the second time dont write into the file.
 
You have it allocated "MOD SHR".

Did you get a non-zero return code from the ALLOC ?

Frank Clarke
--America's source for adverse opinions since 1943.
 
i continue trying and i realise that if i took out the statement finis,
the program write all append but i receve this 2 errors

Code:
IKJ56861I  FILE OUT NOT UNALLOCATED, DATA SET IS OPEN
IKJ56861I  FILE OUT NOT FREED, DATA SET IS OPEN,
 
i made it work.

Here is the code working,

Code:
/* REXX */
COUNT=1
"ALLOC MOD SHR FI(OUT) DA('P1IXF2.PRIVADA.LIBRERIA(PROYEC3)') REUSE"
DO WHILE COUNT <= 3
pull line_in
CALL TST3 line_in
COUNT=COUNT+1
END

Code:
/* REXX */
PARSE ARG line_in
PARSE VALUE LINE_IN WITH NUMERO VARNAME
out.0=2
out.1=numero
out.2=varname
"EXECIO" OUT.0 "DISKW OUT (STEM OUT. FINIS"

I just put the allocate statement out from the cicle and i dont put the free statement.

Could this generate another problem?(to dont put the free)

Many thanks!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top