Copy value from Header to detail records



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Copy value from Header to detail records

Postby tvssv » Mon Aug 10, 2009 10:31 pm

Hi,

I've a sample input file and output files are as below.

My input file is
..........PICC20090327234954JES22UTO                 
09IN02884219003000300326046340840031FLC      000102880
09IN02884219003000300326072480460031FLC      000102880
09IN02884219003000300326072492950031FLC      000102880
14NJ50461973948999093397394899909331FLCAEA   000150460
14NJ50462973948999857597394899985751FLCVMA   000150460
..........PICC20090327234954JES22UTO00001049658

OUPUT File after excluding 14NJ and having only 09IN in output file after reformating should be as below
..........PICC20090327234954JES22UTO                           
780821900300032604634084003            02880288Y260463420090327
780821900300032607248046003            02880288Y260724420090327
780821900300032607249295003            02880288Y260724420090327
..........PICC20090327234954JES22UTO00001049658


In output last 8 characters are from header date.
The complete requirement is as below for above example.
I've a input file. From this file I need to include only records having ‘09IN’ in first 4 characters in file and reformat the file as below.

The format of the output file is as below.

POS 1-4 IN REFORMATTED FILE SHOULD BE Pos 1-2 AND Pos 3-4 OF INPUT FILE AND Value should always be set to 7808

Pos 5-14 IN REFORMATTED FILE SHOULD BE Pos 10-12 ,Pos 13-15 and
Pos 16-19 of input file

Pos 15-24 IN REFORMATTED FILE SHOULD BE Pos 23-25,Pos 26-28 and
Pos 29-32 of input file

Pos 25-29 IN REFORMATTED FILE SHOULD B Pos 20-22 of input file

Pos 30-39 in reformatted file should be Reserved (Populate w/ spaces)

Pos 40-43 in reformatted file should be Pos 5-8 of input file

Pos 44-47 in reformatted file should be Pos 50-53 of input file

Pos 48 in reformatted file should be Populate ‘Y’

Pos 49-54 in reformatted file should be Pos 23-25 and Pos 26-28 of input file

Pos 55 in reformatted file should be Pos 9 of input file

Pos 56-63 in reformatted file should be Pos 15-22 in input header record (which is date)

Pos 64-70 in reformatted file should be Populate spaces

Please suggest me the sort code to do this.
In input dataset Header is starting with low values(hex 0000) and Trailer with high values(hex FFFF). I need to include this header and trailer along with detail records, but detail records should be only '09IN'
"Pos 56-63 in reformatted file should be Pos 15-22 in input trailer record "

Please suggest me the sort code.

Thanks & Regards
Tvssv
tvssv
 
Posts: 6
Joined: Mon Aug 10, 2009 8:41 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Copy value from Header to detail records

Postby Alissa Margulies » Mon Aug 10, 2009 10:42 pm

This can be accomplished in SyncSort for z/OS 1.3 using IFTHEN WHEN=GROUP. What release of SyncSort are you running?
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 3 times

Re: Copy value from Header to detail records

Postby tvssv » Mon Aug 10, 2009 11:02 pm

Hi,
My organization uses SyncSort for z/os 1.3.1. Please suggest the sort steps without using GROUP function. I've only one day with me to complete this. Please, it would be a great help.
Thanks & REgards
Tvssv
tvssv
 
Posts: 6
Joined: Mon Aug 10, 2009 8:41 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Copy value from Header to detail records

Postby Alissa Margulies » Mon Aug 10, 2009 11:08 pm

WHEN=GROUP was included in 1.3.2. You site does not have the current maintenance. I will see if I have time to work on an alternative.
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 3 times

Re: Copy value from Header to detail records

Postby tvssv » Mon Aug 10, 2009 11:15 pm

Thankyou Alissa Margulies so much.

Thanks & Regards
Tvssv
tvssv
 
Posts: 6
Joined: Mon Aug 10, 2009 8:41 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Copy value from Header to detail records

Postby dick scherrer » Mon Aug 10, 2009 11:26 pm

Hello,

If this is due in 1 day, you have hopefully written the bit of code required to do this. This should have taken a couple of hours at most. . .

It really makes very little sense to bring a requirement to the forum looking for some immediate solution. Suggest you do not let this become a habit - there may be substantial penalties if the work doesn't get done on time because of waiting on a forum answer.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Copy value from Header to detail records

Postby dick scherrer » Mon Aug 10, 2009 11:28 pm

Hello,

It does not matter that you are in a hurry. . .

Do NOT double post a question.

The duplicate has been deleted.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Copy value from Header to detail records

Postby Alissa Margulies » Tue Aug 11, 2009 1:20 am

tvssv wrote:Pos 56-63 in reformatted file should be Pos 15-22 in input header record (which is date)...
"Pos 56-63 in reformatted file should be Pos 15-22 in input trailer record "
This is conflicting information. Which is it?
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 3 times

Re: Copy value from Header to detail records

Postby Alissa Margulies » Tue Aug 11, 2009 1:53 am

Assuming the date is coming from the header record, try this untested job:
//S1     EXEC PGM=SORT                           
//SYSOUT   DD SYSOUT=*                           
//SORTIN   DD DSN=INPUT.FILE,DISP=SHR             
//SORTOF01 DD DSN=&&TEMP1,DISP=(NEW,PASS)         
//SORTOF02 DD DSN=&&TEMP2,DISP=(NEW,PASS)         
//SYSIN    DD *                                   
  OUTFIL FILES=01,                               
    INCLUDE=(1,4,CH,EQ,L(C'09IN',X'0000',X'FFFF')),
    IFTHEN=(WHEN=(1,4,CH,EQ,C'09IN'),             
    BUILD=(1:C'7808',                             
           5:10,10,                               
          15:23,10,                               
          25:20,03,                               
          30:10X,                                 
          40:05,04,                               
          44:50,04,                               
          48:C'Y',                               
          49:23,06,                               
          55:09,01,                               
          64:7X,                                 
          71:C'1')),                             
    IFTHEN=(WHEN=NONE,OVERLAY=(71:C'0')           
  OUTFIL FILES=02,INCLUDE=(1,4,CH,EQ,X'0000'),   
    BUILD=(1:15,8,9:C'1')                         
/*                                             
//S2     EXEC PGM=SORT                         
//SORTJNF1 DD DSN=&&TEMP1,DISP=SHR             
//SORTJNF2 DD DSN=&&TEMP2,DISP=SHR             
//SORTOUT  DD DSN=OUTPUT.FILE,...             
//SYSOUT   DD SYSOUT=*                         
//SYSIN    DD *                               
  JOINKEYS FILES=F1,FIELDS=(71,1,A)           
  JOINKEYS FILES=F2,FIELDS=(9,1,A)             
  JOIN UNPAIRED,F1                             
  REFORMAT FIELDS=(F1:1,70,F2:1,8),FILL=(X'FF')
  SORT FIELDS=(1,4,CH,A)                       
  OUTREC IFTHEN=(WHEN=(71,8,CH,NE,X'FF'),     
  BUILD=(1,55,71,8,64,7)),                     
  IFTHEN=(WHEN=NONE,BUILD=(1,70))             
/*                                             
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 3 times

Re: Copy value from Header to detail records

Postby tvssv » Tue Aug 11, 2009 2:36 pm

Thank you very much Alissa.

I have tested the code with below changes.

//SYSIN     DD *                                                     
  SORT FIELDS=COPY           -Added this statement because it was giving sort missing error                                               
  OUTFIL FILES=01,                                                   
      INCLUDE=(1,4,CH,EQ,L(C'09IN',X'00000000',X'FFFFFFFF')), 
- Modified this values since it was not writing trailer Record if I keep X'0000' and X'FFFF'

      IFTHEN=(WHEN=(1,4,CH,EQ,C'09IN'),                               
      BUILD=(1:C'7808',                                               
             5:10,10,                                                 
            15:23,10,                                                 
            25:20,03,                                                 
            30:10X,                                                   
            40:05,04,                                                 
            44:50,04,                                                 
            48:C'Y',                                                 
            49:23,06,                                                 
            55:09,01,                                                 
            64:7X,                                                   
            71:C'1')),                                               
      IFTHEN=(WHEN=NONE,OVERLAY=(71:C'0'))                           
      OUTFIL FILES=02,INCLUDE=(1,4,CH,EQ,X'00000000'),    - Modified this value
          BUILD=(1:15,8,9:C'1')                           
/*                                                       


//SYSIN     DD *                               
  JOINKEYS FILES=F1,FIELDS=(71,1,A)             
  JOINKEYS FILES=F2,FIELDS=(9,1,A)             
  JOIN UNPAIRED,F1                             
  REFORMAT FIELDS=(F1:1,70,F2:1,8),FILL=(X'40')    
- changed to X'40' since it was writing high values in header and trailer
  SORT FIELDS=(1,4,CH,A)                       
  OUTREC IFTHEN=(WHEN=(71,8,CH,NE,X'FF'),       
  BUILD=(1,55,71,8,64,7)),                     
  IFTHEN=(WHEN=NONE,BUILD=(1,70))               
/*


Can you please explain what is the use of
INCLUDE=(1,4,CH,EQ,L(C'09IN',X'00000000',X'FFFFFFFF')),statment.

Thank you once again.

Thanks & Regards
Tvssv
tvssv
 
Posts: 6
Joined: Mon Aug 10, 2009 8:41 pm
Has thanked: 0 time
Been thanked: 0 time

Next

Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post