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

Selection of a Block of Records.


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Subhasish Sarkar

New User


Joined: 21 Oct 2011
Posts: 16
Location: India

PostPosted: Mon Oct 24, 2011 2:41 pm
Reply with quote

Dear All,

I have a file, say, with the below record format.

LINE1 MPR BBB CCCC
LINE2 1112223334445
LINE3 0006666689076
LINE4 ####AAKSLSLS

LINE5 MPS FFF LLLL
LINE6 47474748009
LINE7 97777474747
LINE8 *****uieure0

Say, LINE1 to LINE4 and LINE5 to LINE8 constitute a particular Block of Record.

IF the 1st 3 characters = 'MPR', THEN select the entire block (LINE1 through LINE4).
On the other hand, IF the 1st 3 characters = 'MPS', THEN reject the entire Block (LINE5 through LINE8).

How could this be acheived using SORT?
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Mon Oct 24, 2011 2:48 pm
Reply with quote

Hello,
Will all the blocks have only 4 records?
What SORT product do you have at your shop?
Does the input file actually have a blank line separating blocks between line4 and line5?
What are the LRECL & RECFM of the input and output datasets.?
Back to top
View user's profile Send private message
Subhasish Sarkar

New User


Joined: 21 Oct 2011
Posts: 16
Location: India

PostPosted: Mon Oct 24, 2011 2:59 pm
Reply with quote

Hi Vasanth,

Yeah, you are right. The Block structure would be fixed (say, 4 Records per block). DFSORT is what we use.

The input file does not have any blank line separating the blocks between LINE4 and LINE5. Actually, the Input File would have hundreds and thousands of such block of records and there would be absolutely no space separating each block of record.

RECFM=FB and LRECL=80.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Mon Oct 24, 2011 3:10 pm
Reply with quote

Try this,
Code:
//JS010    EXEC PGM=SORT                                         
//SORTIN   DD DISP=SHR,DSN=WELLS.SORTIN                       
//SORTOUT  DD DISP=OLD,DSN=WELLS.SORTOUT                       
//SYSOUT   DD SYSOUT=*                                           
//SYSIN DD *                                                     
   OPTION COPY                                                   
   INREC IFTHEN=(WHEN=GROUP,RECORDS=4,PUSH=(81:7,3))             
   OUTFIL FNAMES=SORTOUT,INCLUDE=(81,3,CH,EQ,C'MPR'),BUILD=(1,80)
/*       


This type of topics have already been discussed several times. Next time please search the forum for previous similar topics before posting.
Back to top
View user's profile Send private message
Subhasish Sarkar

New User


Joined: 21 Oct 2011
Posts: 16
Location: India

PostPosted: Mon Oct 24, 2011 3:59 pm
Reply with quote

Hi Vasanth,

Working perfectly fine as per my expectations and requirements!!! Thanks a lot.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Oct 24, 2011 10:08 pm
Reply with quote

vasanthz wrote:
Try this,
Code:
//JS010    EXEC PGM=SORT                                         
//SORTIN   DD DISP=SHR,DSN=WELLS.SORTIN                       
//SORTOUT  DD DISP=OLD,DSN=WELLS.SORTOUT                       
//SYSOUT   DD SYSOUT=*                                           
//SYSIN DD *                                                     
   OPTION COPY                                                   
   INREC IFTHEN=(WHEN=GROUP,RECORDS=4,PUSH=(81:7,3))             
   OUTFIL FNAMES=SORTOUT,INCLUDE=(81,3,CH,EQ,C'MPR'),BUILD=(1,80)
/*       


This type of topics have already been discussed several times. Next time please search the forum for previous similar topics before posting.

Hi vasanthz,
What if input is like this..
Code:

LINE2 1112223334445 
LINE1 MPR BBB CCCC   
LINE2 1112223334445 
LINE3 0006666689076 
LINE4 ####AAKSLSLS   
LINE5 MPS FFF LLLL   
LINE6 47474748009   
LINE7 97777474747   
LINE8 *****UIEURE0   
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Oct 24, 2011 10:17 pm
Reply with quote

Subhasish Sarkar wrote:
Hi Vasanth,

Working perfectly fine as per my expectations and requirements!!! Thanks a lot.

You can use this.. Small change to Vasanthaz change.

Code:

//SYSIN DD *                                                     
   OPTION COPY                                                   
   INREC IFTHEN=(WHEN=GROUP,BEGIN=(7,3,CH,EQ,C'MPR'),RECORDS=4, 
   PUSH=(81:7,3))                                               
   OUTFIL FNAMES=SORTOUT,INCLUDE=(81,3,CH,EQ,C'MPR'),BUILD=(1,80)
/*                                                               
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Oct 24, 2011 10:34 pm
Reply with quote

Hello,

The requirement says that the records will be blocks beginning with MPR.

I would think that anything else would be an error. . .
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 -> DFSORT/ICETOOL

 


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 Join multiple records using splice DFSORT/ICETOOL 5
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
No new posts JCL sortcard to print only the records DFSORT/ICETOOL 11
Search our Forums:

Back to Top