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

SYNCSORT Drop selected group of records


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

New User


Joined: 24 Feb 2005
Posts: 11

PostPosted: Fri Jan 02, 2009 7:06 pm
Reply with quote

Hi,

I have the following requirement:

There is a file consisting about 1 million records. I want to selectively bypass 3 records in between and copy all the records above & below it. For e.g. here's an example of this file:

Code:
...PRMGBSIC..................EãYUD 2500000
...PRMGSUMM..................E/d01........
..jPRMGLCMP..................E/ü..........
...PRMGBSIC..................EÂøYG 8000000   these
...PRMGSUMM..................EÂÞ01.....@..   three
..íPRMGHCMP..................EÄ.....æ....<   records
...PRMGBSIC..................EÄ;AG 2500000
...PRMGSUMM..................EÄæ01....èð..
..jPRMGLCMP..................EÄ4...èð....@


Here, I wanto to bypass 3 records starting from YG 800000 and copy the records above and below it into a new file. So, basically, after copying, it would look like

Code:
...PRMGBSIC..................EãYUD 2500000
...PRMGSUMM..................E/d01........
..jPRMGLCMP..................E/ü..........
...PRMGBSIC..................EÄ;AG 2500000
...PRMGSUMM..................EÄæ01....èð..
..jPRMGLCMP..................EÄ4...èð....@


How can this be achieved using SYNCSORT?

Thanks.
VK
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Jan 02, 2009 7:13 pm
Reply with quote

vaibhavkolhe,

What is the RECFM/LRECL of your input file?
Also do you have only a single "YG 800000" record in your input file?
Back to top
View user's profile Send private message
genesis786

Active User


Joined: 28 Sep 2005
Posts: 210
Location: St Katherine's Dock London

PostPosted: Fri Jan 02, 2009 10:32 pm
Reply with quote

For SYNCSORT you might need to give more details about your file and its records.

As another thought, if your unwanted records exist sequentially and you know their line count you can also try doing a REPRO, something like this:

Code:

//STEP1    EXEC PGM=IDCAMS,COND=(4,LT)                 
//SYSPRINT DD SYSOUT=*                                 
//SYSOUT DD SYSOUT=*                                   
//INDD   DD DSN=<INPUT DSN>,DISP=SHR 
//OUTDD  DD DSN=<OUTPUT DSN>,         
// DISP=(NEW,KEEP,KEEP),                               
// DCB=(RECFM=FB,LRECL=120,BLKSIZE=0),                 
// SPACE=(CYL,(10,10),RLSE)                             
//SYSIN DD *                                           
  REPRO INFILE(INDD) OUTFILE(OUTDD) COUNT(90)           
/*                                                     
//STEP2    EXEC PGM=IDCAMS,COND=(4,LT)                 
//SYSPRINT DD SYSOUT=*                                 
//SYSOUT DD SYSOUT=*                                   
//INDD   DD DSN=<INPUT DSN>,DISP=SHR 
//OUTDD  DD DSN=<OUTPUT DSN>,DISP=MOD 
//SYSIN DD *                                           
  REPRO INFILE(INDD) OUTFILE(OUTDD) SKIP(94)
/*                                           
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Sat Jan 03, 2009 5:00 pm
Reply with quote

Would the STARTREC, ENDREC or STOPAFT with SKIPREC help in this case? May be with two passes !
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Sat Jan 03, 2009 6:27 pm
Reply with quote

Code:
...PRMGBSIC..................EÂøYG 8000000   these
...PRMGSUMM..................EÂÞ01.....@..   three
..íPRMGHCMP..................EÄ.....æ....<   records

VK,

Can the "PRMGBSIC" be treated as a "header" and the "8000000" be treated as the "value"?
Deleting a headered group of records on the fly should be do-able.....
Back to top
View user's profile Send private message
vaibhavkolhe

New User


Joined: 24 Feb 2005
Posts: 11

PostPosted: Sat Jan 03, 2009 10:31 pm
Reply with quote

Hi,

Here are the answers to some of the answers in previous posts:

- The RECFM = VB & LRECL = 27998.

- I do not know the count of records in this file, so I am not sure if I can use STOPAFT, SKIPREC. Is there a method to find the count of records in the file.

- There are 3 "YG 80" records in the file, but the one I want to eliminate can be uniquely identified by "YG 8000000".

Thanks,
Vaibhav
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sun Jan 04, 2009 2:39 pm
Reply with quote

vaibhavkolhe,

I believe the below SyncSort job might help. From the sample data you posted, I have assumed the position of 'YG 8000000' at 37th pos(including RDW).

Code:
//STEP00  EXEC PGM=SORT                                               
//SORTIN    DD DSN= Input file  VB/LRECL=27998                         
//SORTOUT   DD DSN= Output file VB/LRECL=27998                         
//SYSOUT    DD SYSOUT=*                                               
//SYSIN     DD *                                                       
 INREC IFTHEN=(WHEN=(37,10,CH,NE,C'YG 8000000'),BUILD=(1,4,C'0',30:5)),
       IFTHEN=(WHEN=NONE,BUILD=(1,4,C'1',30:5))                       
 SORT FIELDS=COPY                                                     
 OUTREC OVERLAY=(6:SEQNUM,8,ZD,RESTART=(5,1),                         
                   SEQNUM,8,ZD,RESTART=(6,8),                         
                   SEQNUM,8,ZD,RESTART=(14,8))                         
 OUTFIL BUILD=(1,4,5:30),                                             
        OMIT=(05,1,ZD,EQ,1,OR,                                         
              14,8,ZD,EQ,2,OR,                                         
             (06,8,ZD,EQ,2,AND,22,8,ZD,EQ,1))       
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 Pulling a fixed number of records fro... DB2 2
No new posts DROP & ALTER PARTITION-PBR DB2 0
No new posts Join multiple records using splice DFSORT/ICETOOL 5
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top