Hi Kolusu, I took a look at this, and think I may have confused you by not
being clear about the scope of the hierarchy. Please see the attached file
for more details about the structure of the data, and a better input set
(with my expected output) - I hope, provided I typed this correctly. I
think this should make things clearer...

Thanks again for your help!
Billy

On Tue, Jan 2, 2018 at 10:27 AM, Sri h Kolusu <[email protected]> wrote:

> >>>I never imagined it would be so complex, but I will try to figure it
> out.
>
> Bill,
>
> To begin you have about 16 individual records for each group and you
> wanted bits and pieces from each and then merge them into a single line.
> You also had 3 different customer contact data which needs to be handled
> as all of them start at the same position.
>
> The INREC is used to parse the data and pick the required fields
> The OUTREC is used to merge the required fields into a single record using
> WHEN=GROUP
> The OUTFIL is used to write out the single record from a group of 16
> records.
>
> I noticed that I missed a comma for the 2 contact fields as I only pushed
> 26 bytes instead of 27.  So please change the last 4 IFTHEN statements and
> the corresponding IFTHEN=(WHEN=GROUP statements
>
>
>         IFTHEN=(WHEN=(530,1,ZD,EQ,1),
>        OVERLAY=(358:278,53,
>                 278:53X),HIT=NEXT),
>
>         IFTHEN=(WHEN=(530,1,ZD,EQ,2),
>        OVERLAY=(438:278,53,
>                 278:53X),HIT=NEXT),
>
>         IFTHEN=(WHEN=(545,1,ZD,EQ,1),
>        OVERLAY=(411:331,27,
>                 331:27X)),
>
>         IFTHEN=(WHEN=(545,1,ZD,EQ,2),
>        OVERLAY=(491:331,26,
>                 331:27X))
>
>          IFTHEN=(WHEN=GROUP,BEGIN=(331,1,CH,EQ,C'"'),
>                  PUSH=(331:331,27)),
>          IFTHEN=(WHEN=GROUP,BEGIN=(358,1,CH,EQ,C'"'),
>                  PUSH=(358:358,53)),
>          IFTHEN=(WHEN=GROUP,BEGIN=(411,1,CH,EQ,C'"'),
>                  PUSH=(411:411,27)),
>          IFTHEN=(WHEN=GROUP,BEGIN=(438,1,CH,EQ,C'"'),
>                  PUSH=(438:438,53)),
>          IFTHEN=(WHEN=GROUP,BEGIN=(491,1,CH,EQ,C'"'),
>                  PUSH=(491:491,26)),
>
>
> Thanks,
> Kolusu
>
>
>
> From:   Bill Ashton <[email protected]>
> To:     [email protected]
> Date:   12/29/2017 02:13 PM
> Subject:        Re: Problem creating file of combined records with SORT
> Sent by:        IBM Mainframe Discussion List <[email protected]>
>
>
>
> Thanks, Kolusu; I will be leaving shortly, too, and will give this a try
> in
> the next week or so. I never imagined it would be so complex, but I will
> try to figure it out.
>
> Happy new year!
> Billy
>
>
>
>
>
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO IBM-MAIN
>



-- 
Thank you and best regards,
*Billy Ashton*

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN
Kolusu, I am sorry for the confusion. Below is a better sample set, and 
then showing what the output should be.

Notes:
1. The CUST MASTER$ is the highest part of the hierarchy - 1 per customer. 
   It has multiple data elements possible, with only one of each record type,
   but I am only interested in the one CM03 record for this customer.
2. The CUST REG is a region for the customer. There are 1 - n possible Regions
   within each CUST MASTER. It also has multiple data elements possible (one
   record each), and I am looking for the CR02 record.
3. The CUST LOC1 holds location details for 1 - n locations in each region. 
   As above, multiple data records, and I am looking only for the CL01 record.
4. The CUST CONT$ holds 1 - n contacts for each location, and I am looking for
   details from multiple fields in the CC02 record.
   
When done, I would expect one record for each contact (made up of the CUST
CONT$ plus CC02 data), with corresponding information for the Location (from
the CUST LOC1 plus CL01), Region (CUST REG plus CR02), and Master (CUST 
MASTER$ plus CM03) above it in the hierarchy.


>CUST MASTER$,FIRST-CUSTOMER NAME(A)                             
CM01 nothing to take from here.
CM02 nothing to take from here.
CM03 01020 <more data here...>               
>CUST REG,EAST CENTRAL US(A)            
CR01 nothing to take from here.
CR02 ECU <more data here...>                         
>CUST LOC1,HARPERS FERRY, WV                 
CL01 USZ 25425-2418      <more data here...>    
>CUST CONT$,JOE SMITH           
CC01 nothing to take from here.
CC02 EXU 01 S B 3045350000      <more data here...>  
>CUST CONT$,ROBERT WILLIAMS                                        
CC02 SCU 02 C M 8179990000      <more data here...>
>CUST REG,SPAIN(A)            
CR01 nothing to take from here.
CR02 SPA <more data here...>
>CUST LOC1,VALENCIA, SPAIN                 
CL01 SPP 46009           <more data here...>   
>CUST CONT$,RICARDO GOMEZ-VALERIA                                           
CC02 APC 01 P X 34963940000     <more data here...> 
>CUST MASTER$,SECOND-CUSTOMER NAME(A)                             
CM01 nothing to take from here.
CM02 nothing to take from here.
CM03 03344 <more data here...>               
>CUST REG,SOUTH WEST US(A)            
CR01 nothing to take from here.
CR02 SWU <more data here...>                         
>CUST LOC1,YUMA, AZ                 
CL01 USZ 85365-1234      <more data here...>    
>CUST CONT$,WILLIAM VEGA           
CC01 nothing to take from here.
CC02 SCU 05 Z B 9282480000      <more data here...>  
>CUST CONT$,MARIA HERNANDEZ                                        
CC02 SCU 02 C M 9282480000      <more data here...>


output #1 CSV file with Commas/quotes:
"FIRST-CUSTOMER NAME","01020","EAST CENTRAL US","ECU","HARPERS FERRY, 
WV","USZ","25425-2418","JOE SMITH","EXU","01","S","B","3045350000"
"FIRST-CUSTOMER NAME","01020","EAST CENTRAL US","ECU","HARPERS FERRY, 
WV","USZ","25425-2418","ROBERT WILLIAMS","SCU","02","C","M","8179990000"
"FIRST-CUSTOMER NAME","01020","SPAIN","SPA","VALENCIA, 
SPAIN","SPP","46009","RICARDO GOMEZ-VALERIA","APC","01","P","X","34963940000"
"SECOND-CUSTOMER NAME","03344","SOUTH WEST US","SWU","YUMA, 
AZ","USZ","85365-1234","WILLIAM VEGA","SCU","05","Z","B","9282480000"
"SECOND-CUSTOMER NAME","03344","SOUTH WEST US","SWU","YUMA, 
AZ","USZ","85365-1234","MARIA HERNANDEZ","SCU","02","C","M","9282480000"


output #2 Mainframe standard column file 
<#1-Len50><#2-Len5><#3-Len50><#4-Len3><#5-Len50><#6-Len3><#7-Len15><#8-Len50><#9-Len3><#10-Len2><#11-Len1><#12-Len1><#13-Len12>

FIRST-CUSTOMER NAME                               01020EAST CENTRAL US          
               ECUHARPERS FERRY, WV                                 
USZ25425-2418     JOE SMITH                                         
EXU01SB3045350000  
FIRST-CUSTOMER NAME                               01020EAST CENTRAL US          
               ECUHARPERS FERRY, WV                                 
USZ25425-2418     ROBERT WILLIAMS                                   
SCU02CM8179990000
FIRST-CUSTOMER NAME                               01020SPAIN                    
               SPAVALENCIA, SPAIN                                   SPP46009    
      RICARDO GOMEZ-VALERIA                             APC01PX34963940000
SECOND-CUSTOMER NAME                              03344SOUTH WEST US            
               SWUYUMA, AZ                                          
USZ85365-1234     WILLIAM VEGA                                      
SCU05ZB9282480000
SECOND-CUSTOMER NAME                              03344SOUTH WEST US            
               SWUYUMA, AZ                                          
USZ85365-1234     MARIA HERNANDEZ                                   
SCU02CM9282480000

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to