multiple header and detail records
Select messages from
# through # FAQ
[/[Print]\]

MVSFORUMS.com -> Utilities

#1: multiple header and detail records Author: ldushkin PostPosted: Wed Sep 13, 2006 9:26 am
    —
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

#2:  Author: Frank YaegerLocation: San Jose PostPosted: Wed Sep 13, 2006 10:31 am
    —
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

#3:  Author: ldushkin PostPosted: Wed Sep 13, 2006 11:27 am
    —
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

#4:  Author: Frank YaegerLocation: San Jose PostPosted: Wed Sep 13, 2006 2:13 pm
    —
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?

#5:  Author: ldushkin PostPosted: Wed Sep 13, 2006 6:44 pm
    —
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.

#6:  Author: Frank YaegerLocation: San Jose PostPosted: Wed Sep 13, 2006 7:08 pm
    —
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?

#7:  Author: ldushkin PostPosted: Thu Sep 14, 2006 8:52 am
    —
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

#8:  Author: Frank YaegerLocation: San Jose PostPosted: Thu Sep 14, 2006 11:06 am
    —
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)
/*



MVSFORUMS.com -> Utilities


output generated using printer-friendly topic mod. All times are GMT - 5 Hours

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group