View previous topic :: View next topic
|
Author |
Message |
sshakya2
New User
Joined: 23 Dec 2010 Posts: 17 Location: Mumbai, India
|
|
|
|
Hi
We are trying to check if the file is empty or not using REXX and if the file is empty we are appending 'E' to file name and write the entire string in a PS.
The below piece of code is not working for all the files. Some of the files it is able to write with an appended 'E' but as soon as the file with a bigger name encountered it errored with ISPF error ISPV006. Screenshot attached.
As far as I know we dont variable length limits in REXX ( Atleast we dont have to define them). Although the output file names are not that lengthy too. Please help on this.
We have Another confusion here that whenever EXECIO is used in loop it automatically appends 1 to the stem variable ( Hence you can see the workaround in the code for it ). Does it work this way ??
Code: |
DO I = 1 TO 20
ADDRESS ISPEXEC
"LMDLIST LISTID("VAR1") OPTION(LIST) DATASET(DSVAR1)"
IF RC = 0 THEN
DO
DSNNAME = DSVAR1
ADDRESS TSO
"ALLOC DA('"DSNNAME"') F(TESTF) SHR REUSE"
"EXECIO 1 DISKR TESTF (FINIS STEM DSTEST"
IF RC \= 0 THEN
DO
DSVAR1 = DSNNAME || ' E'
END
"FREE F(TESTF)"
ADDRESS ISPEXEC
ADDRESS ISPEXEC
"DSINFO DATASET('"DSNNAME"')"
IF RUNDATE = ZDSCDATE | RUNDAT2 = ZDSCDATE THEN
DO
ADDRESS TSO
"ALLOC DA('"OUTFILE"') F(OUTFL) MOD"
/* Tried TRACE and Code is abending with ISPV006 here */
"EXECIO 1 DISKW OUTFL (FINIS STEM DSVAR"
"FREE F(OUTFL)"
END
END
END
ADDRESS ISPEXEC
"LMDLIST LISTID("VAR1") OPTION(FREE)"
|
ISPV006 is the error I am getting. Please help |
|
Back to top |
|
|
sshakya2
New User
Joined: 23 Dec 2010 Posts: 17 Location: Mumbai, India
|
|
|
|
ISPV006 Data truncation occurred - Data for aaaaaaaa format variable
"bbbbbbbb" was too long.
Explanation: The variable value being updated is longer than the length
specified on the VDEFINE for the variable in question.
User response: Contact the responsible programmer.
I have kept the RECLENGTH of the output file as 80. It should be good enough !!! |
|
Back to top |
|
|
sshakya2
New User
Joined: 23 Dec 2010 Posts: 17 Location: Mumbai, India
|
|
|
|
And this is all REXX Code. So Lengths shouldn't be aproblem here ?? Please correct me if i am wrong. |
|
Back to top |
|
|
sshakya2
New User
Joined: 23 Dec 2010 Posts: 17 Location: Mumbai, India
|
|
|
|
Also, the name of the next file which code should be about to list is of 40 characters.
I have tried increasing the RECLENGTH of output file to 2500 from 80. It is still giving the same abend. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Note that in your EXECIO statements you are not specifying a stem, but a partial name. You have
Code: |
"EXECIO 1 DISKR TESTF (FINIS STEM DSTEST" |
which indeed causes EXECIO to concatenate a number to DSTEST. If instead you wrote
Code: |
"EXECIO 1 DISKR TESTF (FINIS STEM DSTEST." |
it would be a true stem (note the period) and your input record would in variable DSTEST.1.
Please post the trace for the iteration of the outermost loop in which the abend occurs. It is possible that appending the "E" causes either the DSN or the LLQ to be of an invalid length. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Where is the LMDINIT statement ? |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
I've been trying to figure out why the error message is from ISPF and not from REXX. I think that mixing the ISPF variable DSVAR1 with a REXX stem variable of the same name is the culprit. |
|
Back to top |
|
|
sshakya2
New User
Joined: 23 Dec 2010 Posts: 17 Location: Mumbai, India
|
|
|
|
Akatsukami: Thanks for the clarification of STEM EXECIO appending 1. New learning for me today. The requirement is such that we cant write an array so used it this way.
EXPAT : I have written LMDINIT Statement too in the code but not mentioned in the screenshot.
Superk : Bingo !!!! You nailed the issue. I introduced another variable and it worked. Can never thank you enough !!!
Code snippet is below :
Code: |
ADDRESS ISPEXEC
"LMDLIST LISTID("VAR1") OPTION(LIST) DATASET(DSVAR1)"
IF RC = 0 THEN
DO
DSNNAME = DSVAR1
FINDSN1 = DSVAR1
ADDRESS TSO
"ALLOC DA('"DSNNAME"') F(TESTF) SHR REUSE"
"EXECIO 1 DISKR TESTF (FINIS STEM DSTEST"
IF RC \= 0 THEN
DO
FINDSN1 = DSNNAME || ' E'
END
"FREE F(TESTF)"
DO
ADDRESS TSO
"ALLOC DA('"OUTFILE"') F(OUTFL) MOD"
"EXECIO 1 DISKW OUTFL (FINIS STEM FINDSN"
"FREE F(OUTFL)"
END
END
|
|
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Why are you opening and closing the output file every time you want to write a record? And why not store all the data to be written in a stem and write at the end? |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Nic Clouston wrote: |
Why are you opening and closing the output file every time you want to write a record? And why not store all the data to be written in a stem and write at the end? |
sshakya2 wrote: |
The requirement is such that we cant write an array so used it this way. |
Very few software engineers have either the knowledge or the seniority to question "requirements", however foolish. |
|
Back to top |
|
|
sshakya2
New User
Joined: 23 Dec 2010 Posts: 17 Location: Mumbai, India
|
|
|
|
Nic .. The file which I am writing is being written from multiple places with different data streams one by one.
Akatsukami : Thanks for your "Non Required" comments too. |
|
Back to top |
|
|
|