View previous topic :: View next topic
|
Author |
Message |
sivatechdrive
Active User
Joined: 17 Oct 2004 Posts: 191 Location: hyderabad
|
|
|
|
I'm in need of some help on merge, the details are given below.
Both the input datasets SORTIN01,SORTIN02 have headers, I want to skip the header present in SORTIN02 while merging (so that only 1 header is present in output file). Is there any way to skip the 1st record from the SORTIN02 dataset
(my system analyst is not ready to use an additonal step that OMIT the header and use the output file in the below step)
Code: |
//STEP0025 EXEC PGM=SYNCSORT
//SYSOUT DD SYSOUT=*
//SORTIN01 DD DSN=DATASET1,DISP=OLD
//SORTIN02 DD DSN=DATASET2,DISP=OLD
//*
//SORTOUT DD DSN=DATASET3,
// DISP=(,PASS,DELETE),
// SPACE=(TRK,(400,900),RLSE)
//SYSIN DD *
MERGE FIELDS=(1,13,CH,A)
/*
//*
|
Thanks
Prasad |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
sivatechdrive
Is there a way that you can distinguish between the header records and the detail records?
What is LRECL and RECFM of both the files? |
|
Back to top |
|
|
sivatechdrive
Active User
Joined: 17 Oct 2004 Posts: 191 Location: hyderabad
|
|
|
|
For Both the Files the LRECL is 110 and RECFM is F (Fixed) |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
sivatechdrive
You havent answered my first question
Quote: |
Is there a way that you can distinguish between the header records and the detail records? |
|
|
Back to top |
|
|
sivatechdrive
Active User
Joined: 17 Oct 2004 Posts: 191 Location: hyderabad
|
|
|
|
from 1-6 positions The Header records will be '000000'
and for the detail records from position 1-6 it will be not zeros |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
sivatechdrive,
This might be of some help to you.
Code: |
//STEP00 EXEC PGM=SORT
//SORTIN01 DD DISP=SHR,DSN= Input-1 , FB/LRECL=110
//SORTIN02 DD DISP=SHR,DSN= Input-2 , FB/LRECL=110
//SORTOUT DD DISP=SHR,DSN= Output , FB/LRECL=110
//SYSOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(111:C'1')),
IFTHEN=(WHEN=(1,6,CH,EQ,C'000000'),OVERLAY=(111:SEQNUM,1,ZD))
MERGE FIELDS=(1,13,CH,A)
OUTFIL BUILD=(1,110),INCLUDE=(111,1,CH,EQ,C'1')
|
|
|
Back to top |
|
|
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
Arun's solution can be simplified slightly as follows:
Code: |
//SYSIN DD *
INREC IFTHEN=(WHEN=(1,6,CH,EQ,C'000000'),OVERLAY=(111:SEQNUM,1,ZD))
MERGE FIELDS=(1,13,CH,A)
OUTFIL BUILD=(1,110),OMIT=(111,1,CH,GT,C'1') |
|
|
Back to top |
|
|
sivatechdrive
Active User
Joined: 17 Oct 2004 Posts: 191 Location: hyderabad
|
|
|
|
Hi arcvns & Alissa Margulies,
Thanks a lot for the reply. My problem is resolved
Happy new year
Thanks
Prasad |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Prasad,
You're welcome. Wish u the same. |
|
Back to top |
|
|
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
Prasad,
Thanks for letting us know. Happy New Year to you, as well. |
|
Back to top |
|
|
|