Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unexpected Output 1

Status
Not open for further replies.

selva0202

IS-IT--Management
Oct 16, 2008
4
US
Greetings,

I had requirement to retrieve the list of generations available in a partifular GDG and write them on local dataset.

The following is the REXX code which I tried.

/* REXX */
/* SAY TRACE('?I') */
ADDRESS TSO
"ALLOC DA('LOCAL.DSN.TEST') FILE(OUTDD) OLD REUSE"
"EXECIO * DISKR OUTDD (FINIS STEM OUT."
A = OUTTRAP("X.","*")
"LISTCAT ENTRIES('K.DB.DBP1.FDE2006D.CIN2006S.IC')"
CALL OUTTRAP "OFF"
DO L = 1 TO X.0
IF WORD(X.L,1) <> "NONVSAM" THEN ITERATE
OUT = RIGHT(X.L,40)
"EXECIO * DISKW OUTDD (FINIS STEM OUT."
SAY OUT
END

OUTPUT
-------

K.DB.DBP1.FDE2006D.CIN2006S.IC.G6087V00
K.DB.DBP1.FDE2006D.CIN2006S.IC.G6088V00
K.DB.DBP1.FDE2006D.CIN2006S.IC.G6089V00
K.DB.DBP1.FDE2006D.CIN2006S.IC.G6090V00
K.DB.DBP1.FDE2006D.CIN2006S.IC.G6091V00
K.DB.DBP1.FDE2006D.CIN2006S.IC.G6092V00
K.DB.DBP1.FDE2006D.CIN2006S.IC.G6093V00
K.DB.DBP1.FDE2006D.CIN2006S.IC.G6094V00
K.DB.DBP1.FDE2006D.CIN2006S.IC.G6095V00
K.DB.DBP1.FDE2006D.CIN2006S.IC.G6096V00

There is a problem in writing these output in the local dataset.

Can someone will help me in this?

- Selva
 
You didn't change the contents of the output dataset. You loaded stem OUT. from the dataset
Code:
"EXECIO * DISKR OUTDD (FINIS STEM OUT."
and wrote the contents of the stem back to the dataset
Code:
"EXECIO * DISKW OUTDD (FINIS STEM OUT."
but you never changed the stem between the two operations. The statement
Code:
 OUT = RIGHT(X.L,40)
only sets variable "OUT" and doesn't affect the stem.

If you intend to replace the dataset's contents with the new list, do this:

1) initialize the stem but don't load it
Code:
out. = 0
2) load each DSN from the LISTCAT into a new member of the stem
Code:
parse value out.0+1 Right(x.l,40)  with,
              $z$   out.$z$    1  out.0  .
3) when the loop is finished, then write the dataset:
Code:
"EXECIO" out.0 "DISKW OUTDD (FINIS STEM OUT."
(Notice that I did not "EXECIO * DISKW".)

The "magical incantation" in (2) may take you a week or two to figure out, but it will work.

Good luck.


Frank Clarke
--Is it time for another Boston Tea Party?
 
I have a similar requirement to retrieve the list of generations available in a partifular GDG but the difference is I want a list of all the GDG generations including the migrated generations. The program to list and write all the cataloged entries LISTC entries is working fine but it only gives us the datasets that are not migrated. Can any one please let me know how to get around this issue. Is there a way to list all generation names insluding the ones migrated.

Any help on this regard is greatly appreciated.

Thank you all in advance.
 
Hi rexxhead,
Your construction with PARSE VALUE
Code:
parse value out.0+1 Right(x.j,40) with $z$ out.$z$ 1 out.0 .
I have never seen it before. It's very nice /but I was confused with l(L) and 1(one), so I changed the index l(L) to j/. :)

I figured out, that it parses the 2 values from the left side into the 2 variales on the right side and then again the values from the 1.position on the left side into out.0 and the rest into the dummy placeholder ".", i.e. it causes during the parsing the incrementation:
out.0 = out.0 + 1
too.

In end effect this
Code:
out. = 0 
do j = 1 to x.0  
  parse value out.0+1 Right(x.j,40) with 
              $z$ out.$z$ 1 out.0 .
end
seems to do the same thing as this:
Code:
out. = 0
out.0 = x.0 
do j = 1 to x.0
  out.j = x.j  
end

Thank you for the valuable suggestions!
 
I forgot RIGHT() on the last code
Code:
out. = 0
out.0 = x.0
do j = 1 to x.0
  out.j = Right(x.j,40)  
end
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top