IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

overlay from a previois record


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Thu Dec 28, 2006 10:27 pm
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:

Use [URL] BBCode for External Links

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
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 Developer


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

PostPosted: Fri Dec 29, 2006 5:04 am
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:

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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top