View previous topic :: View next topic
|
Author |
Message |
Don Allard
New User
Joined: 05 Jun 2008 Posts: 3 Location: Providence, RI
|
|
|
|
I have a REXX script that I run in batch in Z/OS that will read an input file, manipulate data based on certain conditions and move that manipulated data to an output stem. The data is in x12 format so a variable number of input records will constitute a transaction set. I also eliminate some transaction sets based on certain conditions. I set my output stem value in a DO loop from the input stem one by one. My question is if it is possible to manually set an EOF marker into my output stem if I'm eliminating the last transaction set from the input file. I can add logic to forego setting my output stem records until I know whether I want to eliminate that set but it seems like a lot of extra work if it's possible to force REXX to recognize an EOF marker in my output stem so I can just use an EXECIO on the stem and anything I've written to the output stem subsequent to that is just junk I don't want written. I've searched REXX forums but don't find any references to doing what I want to do. |
|
Back to top |
|
|
Don Allard
New User
Joined: 05 Jun 2008 Posts: 3 Location: Providence, RI
|
|
|
|
This post can be withdrawn. I tested the job setting the value of the stem variable to null where I want the output to stop and it treated it as the EOF and ignored the fact that I had set subsequent values previously. For example, If these were the original values copied from input to output:
out.89 = in.75
out.90 = in.76
out.91 = in.77
out.92 = in.78
I set the values like this to save the GE and IEA segments in the out file and nulled the next stem value. I'm excluding the code where the transaction count was modified on the GE segment bc it really isn't pertinent to my question.
out.89 = out.91
out.90 = out.92
out.91 = ''
This caused the EXECIO to treat out.91 as the EOF and ignore any values greater than out.91 that were previously set.
"EXECIO * DISKW OFILE (STEM out."
ps. that is an extremely nasty earwax ad |
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 712 Location: Denmark
|
|
|
|
This is an old discussion. Never use the asterix for DISKW, use a specific number. Then to drop the last record, do EXECIO -1+stem.0 DISKW .. |
|
Back to top |
|
|
Don Allard
New User
Joined: 05 Jun 2008 Posts: 3 Location: Providence, RI
|
|
|
|
Maybe I'm missing something. If the last transaction set was one to be eliminated then the stem could have had more values written to it than I wished to write as output. So I was unsure that stem.0 would be applicable and I'm still unsure of that. And for an old topic it was pretty hard to find an answer in the forum. I don't post a question if I can find the answer in the forum. I do my research. And I don't rely on others to resolve my issues as is evident in that I solved my own problem. Maybe next time just respond with the post that answers my question so I would better be able to find answers in the future. But thanks anyway. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2012 Location: USA
|
|
|
|
Don Allard wrote: |
Maybe I'm missing something. If the last transaction set was one to be eliminated then the stem could have had more values written to it than I wished to write as output. So I was unsure that stem.0 would be applicable and I'm still unsure of that. And for an old topic it was pretty hard to find an answer in the forum. I don't post a question if I can find the answer in the forum. I do my research. And I don't rely on others to resolve my issues as is evident in that I solved my own problem. Maybe next time just respond with the post that answers my question so I would better be able to find answers in the future. But thanks anyway. |
Simple answer has been given above: use explicit count of actual output records in your EXECIO DISKW command, either as constant, or as variable; do not use '*' and/or empty string (like '') as so called "EOF marker".
Code: |
out.92 = 'last really needed record'
"EXECIO 92 DISKW (STEM out. FINIS" |
or
Code: |
out.NNN = 'last really needed record'
OutRecCount = NNN
"EXECIO" OutRecCount "DISKW (STEM out. FINIS" |
|
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
The problem with using a null string as an EOF marker is that one day you may have a valid record that is empty so you will terminate your write early. Best to negate that possibility now by calculating the total to write without short-cuts. |
|
Back to top |
|
|
|