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
 

 

How to check the trailer record for the corresponding header

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

New User


Joined: 22 Aug 2005
Posts: 2

PostPosted: Tue Jun 12, 2007 3:50 pm    Post subject: How to check the trailer record for the corresponding header
Reply with quote

Hi Frank,

Please find the below requirement:

I have a file which has many headers and trailers. Certain header doesn't have a corresponding trailer. My requirement is to write the group of records which doesn't have a trailer into one file, some error file and the others to the output file.

The length of input, output and error file is 900. Recfm is FB.

Input:

MH01ABI.....
MM01.........
MM01.........
MT01ABI.....
MH01YQW.....
MM01.......
MM01......
MM01......
MH01POU....
MM01.....
MT01POU.....

where 'MH01' is the header record and 'MT01' is the trailer record. MM01 is the transaction record type.

The output file should be:

MH01ABI.....
MM01.........
MM01.........
MT01ABI.....
MH01POU....
MM01.....
MT01POU.....

and the error file should contain

MH01YQW.....
MM01.......
MM01......
MM01......

Please let me know how to proceed with this using ICETOOL. Also please suggest me some materials to learn icetool from basic.

Thanks.
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: Tue Jun 12, 2007 8:45 pm    Post subject:
Reply with quote

Sangee,

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html

Here's a DFSORT job that will do what you asked for.

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG   DD  SYSOUT=*
//IN DD DSN=...  input file (FB/900)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//CON DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,PASS)
//    DD DSN=*.T2,VOL=REF=*.T2,DISP=(OLD,PASS)
//OUT1 DD DSN=...  output file1 (FB/900)
//OUT2 DD DSN=...  output file2 (FB/900)
//TOOLIN   DD    *
COPY FROM(IN) USING(CTL1)
SPLICE FROM(CON) TO(OUT1) ON(903,8,ZD) KEEPNODUPS KEEPBASE -
  WITHALL WITH(1,901) USING(CTL2)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(903:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(1,4,CH,EQ,C'MH01'),
                OVERLAY=(903:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=NONE,
                OVERLAY=(911:SEQNUM,8,ZD,
                         903:903,8,ZD,SUB,911,8,ZD,M11,LENGTH=8))
  OUTFIL FNAMES=T1,INCLUDE=(1,4,CH,EQ,C'MT01'),OVERLAY=(901:C'BB')
  OUTFIL FNAMES=T2,OVERLAY=(901:C'VV')
/*
//CTL2CNTL DD *
  OUTFIL FNAMES=OUT1,INCLUDE=(901,2,CH,EQ,C'VB'),
    BUILD=(1,900)
  OUTFIL FNAMES=OUT2,INCLUDE=(901,2,CH,EQ,C'VV'),
    BUILD=(1,900)
/*
Back to top
View user's profile Send private message
Sangee

New User


Joined: 22 Aug 2005
Posts: 2

PostPosted: Wed Jun 13, 2007 2:34 pm    Post subject:
Reply with quote

Hi Frank,

Thanks a lot. It is working fine.

I have some doubts regarding the above job,

I can understand that sequential numbers are added to the records but could not understand the control card functions clearly.

I am going through the documents suggested, meanwhile if you can explain me the job it would be of great help.

Thanks.
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: Wed Jun 13, 2007 9:06 pm    Post subject:
Reply with quote

I'm using a variation of the "group" trick discussed in the "Include or omit groups of records" Smart DFSORT Tricks at:

http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/
Back to top
View user's profile Send private message
sangee27

New User


Joined: 16 Mar 2007
Posts: 19
Location: Pune

PostPosted: Thu Jun 14, 2007 6:07 pm    Post subject:
Reply with quote

Hi,

Thanks for the reference given.

I have gone through the trick discussed in the above link.

But i am not still not clear with CTL1. Sequential number is added starting from position 903, also we are checking the condition for the position 901,902 whether the values are equal to 'VB' or 'VV'. But from where we are getting the value VB?

Also could you please explain the significance of the below step

IFTHEN=(WHEN=NONE,
OVERLAY=(911:SEQNUM,8,ZD,
903:903,8,ZD,SUB,911,8,ZD,M11,LENGTH=8))

Your explanation would help me to understand the icetool job better.

Thanks.
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 Jun 14, 2007 10:02 pm    Post subject:
Reply with quote

Quote:
where we are getting the value VB


From the "splice" of position 901 of the base (first) record and position 902 of the overlay (second) record. To understand this, you need to understand how SPLICE works. Complete details on SPLICE are at:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA20/6.13?DT=20060615185603

Also, see the "Create files with matching and non-matching records" Smart DFSORT Trick at:

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

As for the IFTHEN WHEN clause, let's break it down. Before the IFTHEN WHEN, the records look like this:

Code:

                     grpnum
MH01ABI.....         00000001   <--- header = start of group
MM01.........        00000002
MM01.........        00000003
MT01ABI.....         00000004
MH01YQW.....         00000002   <--- header = start of group
MM01.......          00000006
MM01......           00000007
...


WHEN=NONE skips the records that satisifed previous IFTHEN conditions - that would be the header record in this case because of the IFTHEN with WHEN=(1,4,CH,EQ,C'MH01').

After the:

Code:

        IFTHEN=(WHEN=NONE,
                OVERLAY=(911:SEQNUM,8,ZD)),


the records look like this:

Code:

                     grpnum  tempnum
MH01ABI.....         00000001
MM01.........        0000000200000001
MM01.........        0000000300000002
MT01ABI.....         0000000400000003
MH01YQW.....         00000002
MM01.......          0000000600000004
MM01......           0000000700000005
...


and finally after the:

Code:

903:903,8,ZD,SUB,911,8,ZD,M11,LENGTH=8))


The records look like this:

Code:

                     grpnum  tempnum
MH01ABI.....         00000001
MM01.........        0000000100000001
MM01.........        0000000100000002
MT01ABI.....         0000000100000003
MH01YQW.....         00000002
MM01.......          0000000200000004
MM01......           0000000200000005
...


This is just a trick to get group numbers by manipulating sequence numbers and doing a subtraction.
Back to top
View user's profile Send private message
sangee27

New User


Joined: 16 Mar 2007
Posts: 19
Location: Pune

PostPosted: Fri Jun 15, 2007 3:00 pm    Post subject:
Reply with quote

Hi Frank,

Thanks a lot for the explanation. It helped a lot.
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 Record Not found in AlX but record re... mukun264 COBOL Programming 7 Fri Mar 24, 2017 9:28 am
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts To Merge mutliple records into a sing... anandgbe DFSORT/ICETOOL 6 Wed Feb 22, 2017 8:49 am


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