MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

multiple header and detail records

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
ldushkin
Beginner


Joined: 05 Apr 2006
Posts: 56
Topics: 20

PostPosted: Wed Sep 13, 2006 9:26 am    Post subject: multiple header and detail records Reply with quote

I have file with multiple header and detail records.
I need to create output file only where header has 'NG4' in positin 3 and detail record
has '1' in position 47. output file should have only menber# start from 2 pos 20 bite and
group# start from 22 pos 15 bite.

Please help me if it poseble in sort utilities

input file
Code:

----+----1----+----2----+----3----+----4----+----5----+----6
BRNG406244000020002779PEHP                     BI26452MBKLE7
C1741000365504       PEHPSB554X3SA  090520060310911200609112
BRNG406244000030002756HEXCEL CORPORATION       BI32209SBKLC1
C748486297736        AMANCOB2       090520060110911200609112
C079468150862        CSCOBRACDH     090520060110911200609112
C150735215184        HCORPCOBCDH    090520060110911200609112
BRNG406244000050002779PEHP                     BI26452MBKLE7
C1741000532482       PEHPLG1132A1   090520060610911200609112
C1741000533789       PEHPLG1132A1   090520060610911200609112
BRFA406244000010002990NOVARTIS PHARMACEUTICALS BI24772MBKLCL
C793891775384        ACTIVE004      090520060410911200609112
BRFA406244000040001839CHEVRON                  BR925149BKLE7
C723902771760        CTMPUAC        090520060210911200609112
BRFA406244000050005820HOSP FOR SPECIAL SURGERY BI22827MBKLBS
C054421686           PV2497001O9701 090520060110911200609112
BRFA406245000010002596CORNELL UNIVERSITY       BI34731SBKLCC
C1857838             CU50ACT        090520060310911200609112
BRXC406247000020001390HONEYWELL                BI34608MBKLE7
C169781120277        HWA0009        090520060210911200609112
C387345077700        HWA0012        090520060210911200609112
C124996162457        HWA0014        090520060110911200609112
C105366248357        HWA0014        090520060110911200609112
C115350670265        HWA0014        090520060110911200609112
C535732476105        HWA0014        090520060210911200609112
BRNG406248000010001538ITT INDUSTRIES           BI24449MBKLE70
C500016889           C19358402      090620060110911200609112

output file
Code:

1741000365504       PEHPSB554X3SA
748486297736        AMANCOB2       
079468150862        CSCOBRACDH   
150735215184        HCORPCOBCDH 
1741000532482       PEHPLG1132A1
1741000533789       PEHPLG1132A1 
500016889           C19358402
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Sep 13, 2006 10:31 am    Post subject: Reply with quote

Your example shows a 1 in 47 for every detail record in every NG4 group so it's hard to know exactly what you want. Can an NG4 group have a detail record without a 1 in 47? If so, for such an NG4 group do you want (1) any details records that have a 1 in 47 (2) no detail records unless every detail record has a 1 in 47 (3) all detail records if any detail record has a 1 in 47 or (4) ?

For example, what would you want for the output record if you had an NG4 group like this for input?

Code:

BRNG406244000030002756HEXCEL CORPORATION       BI32209SBKLC1
C748486297736        AMANCOB2       090520060110911200609112
C079468150862        CSCOBRACDH     090520060120911200609112
C150735215184        HCORPCOBCDH    090520060110911200609112
C079468150862        CSCOBRACDH     090520060140911200609112

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ldushkin
Beginner


Joined: 05 Apr 2006
Posts: 56
Topics: 20

PostPosted: Wed Sep 13, 2006 11:27 am    Post subject: Reply with quote

Thank you
NG4 only inheader record (3 pos 3 bite)

when we found in header NG4 than we check '1' in detais record pos 47.
Output file need only two fields from detail records


Thanks
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Sep 13, 2006 2:13 pm    Post subject: Reply with quote

You didn't actually answer my question. Please tell me the output records you want for the input records I showed. Note that it's an NG4 group with a '1' in 47 for the first record, a '2' in 47 for the second record, a '1' in 47 for the third record, and a '4' in 47 for the fourth record. Do you just want the first and third records with the two fields, or do you want something else?
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ldushkin
Beginner


Joined: 05 Apr 2006
Posts: 56
Topics: 20

PostPosted: Wed Sep 13, 2006 6:44 pm    Post subject: Reply with quote

Sorry for the delay, I was really busy, and now I can come back to the issue.

I have a file with multiple header records and detail records under each header.
First, I need to check each header record. If it has certain value in position (3:3) only then, check each detail record for the value of "1" in position 47. If both criteria are met, then write only two fields from the input file detail record starting from the following positions (2:20 and 22:15) to the output.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Sep 13, 2006 7:08 pm    Post subject: Reply with quote

You just keep repeating the same thing over and over and ignoring my question. I'm trying to help but I need to know what you want to do when an NG4 group has some detail records with a '1' in 47 and some detail records with something else in 47.

I'll ask the question again. Please answer this time.

Say you have an input group like this with a '1' in 47 for the first detail record, a '2' in 47 for the second detail record, a '1' in 47 for the third detail record, and a '4' in 47 for the fourth detail record.

Code:

BRNG406244000030002756HEXCEL CORPORATION       BI32209SBKLC1
C748486297736        AMANCOB2       090520060110911200609112
C079468150862        CSCOBRACDH     090520060120911200609112
C150735215184        HCORPCOBCDH    090520060110911200609112
C079468150862        CSCOBRACDH     090520060140911200609112


Would you want the following input (the two fields from the first and third detail records):

Code:

748486297736        AMANCOB2     
150735215184        HCORPCOBCDH 


And another question - does B in position 1 indicate a header record and C in position 1 indicate a detail record?
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ldushkin
Beginner


Joined: 05 Apr 2006
Posts: 56
Topics: 20

PostPosted: Thu Sep 14, 2006 8:52 am    Post subject: Reply with quote

Hi Frank,

'1' in position 47 can be in any detail records, it can be in 2,3,4,5 .... and i need only records where '1'.
'B' header records
'C' detail records
your code it in exactly what i need
Thank you very much
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Sep 14, 2006 11:06 am    Post subject: Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for. You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) to do this in one pass as shown. The job won't work correctly (probably no OUT output) if you don't have that PTF. If you see 'ICE201I E' in //DFSMSGS, then you have the PTF. If you see 'ICE201I 0', then you don't have the PTF and you'll need to do this in two passes using a temporary data set - a COPY operator with the INREC statement, and the SPLICE operator with the OUTFIL statement.

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file (FB/60)
//OUT DD DSN=...  output file (FB/35)
//TOOLIN DD *
 SPLICE FROM(IN) TO(OUT) ON(64,8,ZD) -
  WITHALL WITH(1,60) USING(CTL1)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(64:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(1,1,CH,EQ,C'B'),
          BUILD=(61:3,3,64:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=NONE,
          OVERLAY=(72:SEQNUM,8,ZD,
            64:64,8,ZD,SUB,72,8,ZD,M11,LENGTH=8))
  OUTFIL FNAMES=OUT,
     INCLUDE=(61,3,CH,EQ,C'NG4',AND,47,1,CH,EQ,C'1'),
     BUILD=(2,20,22,15)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group