Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Selection of a Block of Records.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Selection of a Block of Records.
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: 1504
Location: Chennai

PostPosted: Mon Oct 24, 2011 2:48 pm    Post subject:
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    Post subject: Reply to: Selection of a Block of Records.
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: 1504
Location: Chennai

PostPosted: Mon Oct 24, 2011 3:10 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Mon Oct 24, 2011 10:34 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us