IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Help in SYNCSORT


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
srini_s

New User


Joined: 10 Mar 2005
Posts: 2

PostPosted: Tue Mar 22, 2005 10:21 am
Reply with quote

Hi all,

I have an input file which looks like this:
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
00011062                                     0901002005-03-17-06.13.50.000000000
0001106201459758                             0901501002005-03-17-04.39.47.000000
0001106201459758001                          090200POS 1C01459758001           
0001106201459758001001001                    0904000000157300000001
0001106201459758001001002                    0904000000371800000001  00000000000
0001106201459758001001003                    0904000000000100000001  00000000000
0001106301459918                             0901501002005-03-17-05.24.51.000000
0001106301459918001                          090200UPS11D1Z20R66V0144688047     
0001106301459918001001001                    0904000000512200000010
0001106301459918001001002                    0904000000512100000015
0001106301459918001001003                    0904000000466800000001  00000000000
0001106301459918001001004                    0904000000001500000001  00000000000
00011063                                     0909000000106500000001  00000000000


The header record is identified by the number '100' in the 49th column. The trailer record is identified by the number '900' in the 49th column.

There are chances where the header record is not the first record in my input file and the trailer record is not the last record in my input file but Trailer record always appears after header record.

Like this,

Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
0001106201459758                             0901501002005-03-17-04.39.47.000000
0001106201459758001                          090200POS 1C01459758001           
0001106201459758001001001                    0904000000157300000001
0001106201459758001001002                    0904000000371800000001  00000000000
0001106201459758001001003                    0904000000000100000001  00000000000
00011062                                     0901002005-03-17-06.13.50.000000000
0001106301459918                             0901501002005-03-17-05.24.51.000000
0001106301459918001                          090200UPS11D1Z20R66V0144688047     
0001106301459918001001001                    0904000000512200000010
0001106301459918001001002                    0904000000512100000015
0001106301459918001001003                    0904000000466800000001  00000000000
0001106301459918001001004                    0904000000001500000001  00000000000
00011063                                     0909000000106500000001  00000000000
0001106201459758                             0901501002005-03-17-04.39.47.000000
0001106201459758001                          090200POS 1C01459758001           
0001106201459758001001001                    0904000000157300000001
0001106201459758001001002                    0904000000371800000001  00000000000
0001106201459758001001003                    0904000000000100000001  00000000000


In this case I need an output file which contains the header record, the trailer record and the records between the header and trailer records. Records above the header record and records below the trailer record should not be included in the output file.

Output desired if the input file is as shown above:
Code:
00011062                                     0901002005-03-17-06.13.50.000000000
0001106301459918                             0901501002005-03-17-05.24.51.000000
0001106301459918001                          090200UPS11D1Z20R66V0144688047     
0001106301459918001001001                    0904000000512200000010
0001106301459918001001002                    0904000000512100000015
0001106301459918001001003                    0904000000466800000001  00000000000
0001106301459918001001004                    0904000000001500000001  00000000000
00011063                                     0909000000106500000001  00000000000


Can anybody provide me a solution to acheive this using SYNCSORT, Easytrieve or SAS?

Thanks,
Srini
Back to top
View user's profile Send private message
somasundaran_k

Active User


Joined: 03 Jun 2003
Posts: 134

PostPosted: Wed Mar 23, 2005 3:29 am
Reply with quote

Hi Srini
Is there multiple Headers and Trilers in the input file ?
Back to top
View user's profile Send private message
somasundaran_k

Active User


Joined: 03 Jun 2003
Posts: 134

PostPosted: Wed Mar 23, 2005 4:04 am
Reply with quote

Hi Srini
Check this Job using SYNCSORT's SYNCTOOL.
Code:

//STEP1 EXEC  PGM=SYNCTOOL                                         
//TOOLMSG DD SYSOUT=*                                             
//DFSMSG DD SYSOUT=*                                               
//IN DD *                                                         
0001106201459758                             0901501002005-03-17-04
0001106201459758001                          090200POS 1C0145975800
0001106201459758001001001                    0904000000157300000001
0001106201459758001001002                    0904000000371800000001
0001106201459758001001003                    0904000000000100000001
00011062 -- HDR                              0901002005-03-17-06.13
0001106301459918                             0901501002005-03-17-05
0001106301459918001                          090200UPS11D1Z20R66V01
0001106301459918001001001                    0904000000512200000010
0001106301459918001001002                    0904000000512100000015
0001106301459918001001003                    0904000000466800000001   
0001106301459918001001004                    0904000000001500000001   
00011063 -- TRL                              0909000000106500000001   
0001106201459758                             0901501002005-03-17-04   
0001106201459758001                          090200POS 1C0145975800   
0001106201459758001001001                    0904000000157300000001   
0001106201459758001001002                    0904000000371800000001   
0001106201459758001001003                    0904000000000100000001   
/*                                                                   
//T1 DD DSN=&&T1,DISP=(,PASS)                                         
//T2 DD DSN=&&T2,DISP=(,PASS)                                         
//CTL2CNTL DD DSN=*.T1,VOL=REF=*.T1,DISP=SHR                         
//         DD DSN=*.T2,VOL=REF=*.T2,DISP=SHR                         
//OUT DD SYSOUT=*                                                     
//TOOLIN DD *                                                         
  COPY FROM(IN) USING(CTL1)                                           
  COPY FROM(IN) USING(CTL2)                                           
/*                                                                   
//CTL1CNTL DD *                                                       
  INREC FIELDS=(1,80,81:SEQNUM,8,ZD)                           
  OUTFIL FNAMES=T1,INCLUDE=(49,3,CH,EQ,C'100'),                 
    OUTREC=(C' OUTFIL FNAMES=OUT,STARTREC=',81,8,C',',80:X)     
  OUTFIL FNAMES=T2,INCLUDE=(49,3,CH,EQ,C'900'),                 
    OUTREC=(C' ENDREC=',81,8,80:X)                             
/*                                                             

Hth.
-Som
Back to top
View user's profile Send private message
srini_s

New User


Joined: 10 Mar 2005
Posts: 2

PostPosted: Wed Mar 23, 2005 8:42 am
Reply with quote

Hi Som,

Yes there could be multiple headers and trailers in my input file.

Thanks,
Srini
Back to top
View user's profile Send private message
somasundaran_k

Active User


Joined: 03 Jun 2003
Posts: 134

PostPosted: Wed Mar 23, 2005 9:36 pm
Reply with quote

Srini
I don't think we can use SYCSORT to solve this problem. Here is an Easytrieve solution for this.
Code:

//STEP05    EXEC PGM=EZTPA00                       
//STEPLIB   DD DSN=SYS1.EASYPLUS.LOADLIB,DISP=SHR   
//SYSOUT    DD SYSOUT=*                             
//SYSPRINT DD SYSOUT=*                             
//SYSSNAP  DD SYSOUT=*                             
//INFILE   DD DSN=YOUR INPUT FILE,DISP=SHR   
//OUTFILE  DD DSN=YOUR OUTPUT FILE,                 
//             DISP=(NEW,CATLG,DELETE),             
//             UNIT=SYSDA,                         
//             SPACE=(CYL,(1,1),RLSE),             
//             DCB=(RECFM=FB,LRECL=80)             
/*                                                 
//SYSIN     DD *                                   
  FILE INFILE                                       
     IN-REC             01 80  A                   
     PART-1             01 48  A                   
     HDR-TRL            49 03  A
  FILE OUTFILE FB (0  0)                       
     OUT-REC            01 80  A               
                                               
    W-CHECK                 W 01 A VALUE ' '   
  JOB INPUT INFILE                               
    OUT-REC = IN-REC                           
    CASE HDR-TRL                               
         WHEN '100'                             
             W-CHECK = 'Y'                     
         WHEN '900'                             
             PUT OUTFILE                       
             W-CHECK = 'N'                     
    END-CASE                                   
    IF W-CHECK = 'Y'                           
       PUT OUTFILE                             
    END-IF                                     
//*             

hth
-Som
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Count Records with a crietaria in a f... DFSORT/ICETOOL 5
No new posts DFSORT/SYNCSORT/ICETOOL JCL & VSAM 8
No new posts Syncsort "Y2C" Function SYNCSORT 1
No new posts Arithmetic division using Syncsort SYNCSORT 6
Search our Forums:

Back to Top