Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

overlay from a previois record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Searchman

New User


Joined: 28 Dec 2006
Posts: 80
Location: France

PostPosted: Thu Dec 28, 2006 2:57 pm    Post subject: overlay from a previois record
Reply with quote

It's easy to do with a COBOL program but It would be much better (faster) in a DFSORT step... if it's possible (after searching in DFSORT application programming, I don't think so) !

record length = 133

If the field (1:8) is not blank (<> spaces) the whole record is written in the output
Else
the field (1:8) takes the value of the previous record whose same field (1:8) wasn't blank

NB : the field (1:8) of the first record is always filled.

(in fact is to transform a report file in a flat file)

Ex :

Input
FIRSTREC REST OF THE RECORD 1 --------------------------
SECNDREC REST OF THE RECORD 2 --------------------------
spaces... REST OF THE RECORD 3 --------------------------
spaces... REST OF THE RECORD 4 --------------------------

Output
FIRSTREC REST OF THE RECORD 1 --------------------------
SECNDREC REST OF THE RECORD 2 --------------------------
SECNDREC REST OF THE RECORD 3 --------------------------
SECNDREC REST OF THE RECORD 4 --------------------------

Overlay of the filed 1:8 in 3rd and 4Th records from 2ND record.

Thank you for your solution.
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Dec 28, 2006 10:27 pm    Post subject:
Reply with quote

Yes, you can do this with the DFSORT/ICETOOL job shown below. You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use INREC with SPLICE. If you don't have the April, 2006 PTF, ask your System Programmer to install it (it's free). (Or alternatively, you can do it in two passes with a COPY operator followed by a SPLICE operator using a temporary data set.) For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file (FB/133)
//OUT DD DSN=...  output file (FB/133)
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(134,8,ZD) -
  KEEPBASE KEEPNODUPS WITHALL WITH(9,125) USING(CTL1)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(134:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(1,8,CH,NE,C' '),
                OVERLAY=(134:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=NONE,
                OVERLAY=(142:SEQNUM,8,ZD,
                         134:134,8,ZD,SUB,142,8,ZD,M11,LENGTH=8))
  OUTFIL FNAMES=OUT,BUILD=(1,133)
/*
Back to top
View user's profile Send private message
Searchman

New User


Joined: 28 Dec 2006
Posts: 80
Location: France

PostPosted: Fri Dec 29, 2006 3:42 am    Post subject: Re: overlay from a previous record
Reply with quote

Your solution is very interesting, thank you, it shows the powerful of ICETOOL.

But it wasn't exactly what I expected because in my example I took firstrec and secndrec like alphanumeric values (characters) and not for numeric value (seqnum of the record). So I see in your solution (if I didn't understand, tell me) that you find out the result by subtracting seqnum of the record = space into the seqnum of record (any), and I must recognize it's very elegant.
So you don't have to know the value of the field 1:8.
But if I have to take this value to fill in the blank (1:8) record which succeed (my problem), what is you proposal ?

Thank you again for your quick and detailed reply.

PS : I didn't find the parameter "sub" in "USE Guide for DFSORTPTFs UQ95214 and UQ95213"
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Dec 29, 2006 5:04 am    Post subject:
Reply with quote

The use of the seqnum (sequence number) has nothing to do with the value in positions 1-8. The value in positions 1-8 can be anything you like. In fact, I used your character values and got the output records you asked for.

The seqnum is used to create group numbers that allow us to propagate the value from the first record of the group (non-blank in positions 1-8) to the other records of the group (blank in positions 1-8). For more details on this "group" technique, see the "Include or omit groups of records" and "Sort groups of records" Smart DFSORT Tricks at:

http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/

I always test any solutions I provide to ensure they give the requested output. The DFSORT/ICETOOL job I provided gives the output you requested based on the input you showed. In the future, please try my solutions rather than assuming they don't do what you ask for. If you did test it and didn't get the correct results, then that's because you don't have the April, 2006 PTF which I warned you about.

SUB is for subtraction. You didn't find it in the description for the Dec, 2004 PTF because it was available before that.
Back to top
View user's profile Send private message
Searchman

New User


Joined: 28 Dec 2006
Posts: 80
Location: France

PostPosted: Sat Dec 30, 2006 2:06 am    Post subject:
Reply with quote

Thank you again.
Sorry, I was wrong in my conclusion : the "move" was done by the splice of course (1:8 out of the with clause). Be sure I have no doubts about your professionalism.

I couldn't test the script because I'm on hollydays this week.

Happy new year !
Back to top
View user's profile Send private message
Searchman

New User


Joined: 28 Dec 2006
Posts: 80
Location: France

PostPosted: Fri Jan 05, 2007 12:10 am    Post subject: Re: overlay from a previois record
Reply with quote

Test OK !
Thank you for your help.
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm
No new posts Format record to remove Leading zeroes Learncoholic DFSORT/ICETOOL 14 Wed Apr 05, 2017 2:43 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us