Page 1 of 1

Write to same line using EXECIO

PostPosted: Wed Jul 09, 2008 10:59 pm
by smirkhan
Hi Everyone,

I was wondering if anyone knew how to read all lines of a dataset and output the lines concatanated on one line in a new dataset.

For example if the input dataset contains:

ABC
DEF
GHI
JKL

The output dataset would look like this:

ABCDEFGHIJKL

Re: Write to same line using EXECIO

PostPosted: Thu Jul 10, 2008 1:55 am
by smirkhan
I actually figured out how to fix this. You can read using a STEM variable. Then use a loop with a temp variable to store each line like so:

"EXECIO * DISKR DATAIN (STEM ST. FINIS"   
IF RC = 0 THEN                           
DO                                       
   TEMP = ST.1                           
   DO I = 2 TO ST.0                                             
      TEMP = STRIP(TEMP) || ST.I         
   END                                   
END                                       
PUSH TEMP                                 
"EXECIO * DISKW DATAOUT"

Re: Write to same line using EXECIO

PostPosted: Thu Jul 10, 2008 2:04 am
by dick scherrer
Hello smirkhan and welcome to the forums,

Good to hear you have it working :)

Please notice your second post - it is now posted with a fixed-font and aligned (which makes it much more readable). To accomplish this, i "Code"ed your post (usng the Code tag on the top of the reply panel). You can also Preview to see what your post will look like to the forum, rather than only being able to see it in the reply editor. When you are satisfied with your post, then click Submit (remember to Submit because if you don't, the post is lost ;) ).

Enjoy the forums,

Re: Write to same line using EXECIO

PostPosted: Thu Jul 10, 2008 6:20 pm
by smirkhan
Hey Dick,

It's good to be on the forums. I've recently gotten into the field and had a course last year at university on mainframe basics which made me very interested in the systems. I'm hoping to gain as much knowledge as I can in the next couple of months before I go back to University for one more year.

I will make sure to follow your instructions on my next post.