IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

Can you manually set an EOF marker in an output stem in REXX


 
IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
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
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
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: 397
Location: Denmark

PostPosted: Sat Nov 02, 2019 2:46 pm
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
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: 877
Location: Maryland

PostPosted: Mon Nov 04, 2019 7:46 pm
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: 2432
Location: Hampshire, UK

PostPosted: Tue Nov 05, 2019 1:46 am
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 All times are GMT + 6 Hours
Forum Index -> CLIST & REXX
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts Calling Assembler from REXX PL/I & Assembler 5
No new posts REXX/CLIST tool for BCSR and EDSR CLIST & REXX 2
No new posts Calling Rexx program from Cobol CLIST & REXX 12
No new posts REXX script to beautify XML CLIST & REXX 1
No new posts Altering output file attributes All Other Mainframe Topics 5

Back to Top