Using fromdsn in a loop?

Discussion of the Co:Z Co-Processing Toolkit for z/OS
Post Reply
usaajrm
Posts: 80
Joined: Tue Feb 06, 2007 3:46 pm

Using fromdsn in a loop?

Post by usaajrm » Thu Mar 24, 2011 1:52 pm

With my problems behind me, I'm writing a bash srcipt (first one). I want to process the records in an MVS dataset. Are there any examples of using a loop? I didn't want to write a script to execute fromdsn and pipe it to another script, which is what I see in the docs examples.[/code]

dovetail
Site Admin
Posts: 1948
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail » Thu Mar 24, 2011 2:31 pm

Try this:

Code: Select all

 fromdsn DD:INPUT | 
 while read line
 do
    echo $line
 done

usaajrm
Posts: 80
Joined: Tue Feb 06, 2007 3:46 pm

Post by usaajrm » Thu Mar 24, 2011 10:56 pm

Works great. Thank you.

usaajrm
Posts: 80
Joined: Tue Feb 06, 2007 3:46 pm

Post by usaajrm » Fri Apr 01, 2011 11:54 am

I wish to reciporcate. After using your suggestion, I found this also works. Thanks again.
while read line
do
array[$i]="$line"
printf "%s\n" "$array[$i]"
((i++))
done < <(fromdsn '//A.DATA.SET(MEMBER)')

Post Reply