Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Can you manually set an EOF marker in an output stem in REXX

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
Don Allard

New User


Joined: 05 Jun 2008
Posts: 3
Location: Providence, RI

PostPosted: Sat Nov 02, 2019 12:30 am    Post subject: Can you manually set an EOF marker in an output stem in REXX
Reply with quote

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
View user's profile Send private message

Don Allard

New User


Joined: 05 Jun 2008
Posts: 3
Location: Providence, RI

PostPosted: Sat Nov 02, 2019 5:31 am    Post subject: Reply to: Can you manually set an EOF marker in an output stem in REXX
Reply with quote

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
View user's profile Send private message
Willy Jensen

Active User


Joined: 01 Sep 2015
Posts: 322
Location: Denmark

PostPosted: Sat Nov 02, 2019 2:46 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Don Allard

New User


Joined: 05 Jun 2008
Posts: 3
Location: Providence, RI

PostPosted: Mon Nov 04, 2019 10:34 am    Post subject: Reply to: Can you manually set an EOF marker in an output stem in REXX
Reply with quote

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
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 603
Location: Maryland

PostPosted: Mon Nov 04, 2019 7:46 pm    Post subject: Re: Reply to: Can you manually set an EOF marker in an output stem in REXX
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2246
Location: Hampshire, UK

PostPosted: Tue Nov 05, 2019 1:46 am    Post subject: Reply to: Can you manually set an EOF marker in an output stem in REXX
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Running a REXX exec program using ZOSMF Sakthi344 CLIST & REXX 1 Tue Oct 15, 2019 3:13 pm
No new posts REXX VSAM Harold Barnes CLIST & REXX 2 Sat Oct 05, 2019 2:38 pm
No new posts REXX for Reading SMF type 70-1 AdrielGB Testing & Performance analysis 6 Sat Oct 05, 2019 3:03 am
No new posts Can GLobal variable used under TSOE/REXX Kaliragavendran CLIST & REXX 5 Tue Sep 24, 2019 7:16 am
No new posts REXX and 3270 highlighting Harold Barnes CLIST & REXX 4 Fri Sep 20, 2019 5:26 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us