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

How to Sort a flat file using condition from an input file!


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

New User


Joined: 19 Aug 2008
Posts: 15
Location: Bangalore

PostPosted: Mon Oct 06, 2008 2:49 pm
Reply with quote

Hi,

Input File to be sorted:
Code:
20080731 XXXXXXXXX
20080825 XXXXXXXXX
20080826 XXXXXXXXX
20080827 XXXXXXXXX
20080828 XXXXXXXXX
20080829 XXXXXXXXX
20080830 XXXXXXXXX
20080831 XXXXXXXXX
20080901 XXXXXXXXX
....


Condition file:
Code:
XXXXX 20080830 XXXXXXXXXX


I would pick the month (i.e., 08 ) from the condition file and sort the input file. ie., the sorted output should have only details for August.

Sorted Output:
Code:
20080825 XXXXXXXXX
20080826 XXXXXXXXX
20080827 XXXXXXXXX
20080828 XXXXXXXXX
20080829 XXXXXXXXX
20080830 XXXXXXXXX
20080831 XXXXXXXXX


I am not sure, but is there any way we can pass the MM value from condition file as INCLUDE condition to sort the input file???
Or there is some other way to do it?
Back to top
View user's profile Send private message
jobin thomas

New User


Joined: 19 Aug 2008
Posts: 15
Location: Bangalore

PostPosted: Mon Oct 06, 2008 3:10 pm
Reply with quote

The value '08' (august month) is to come from the condition file. And using this value I would sort my input file.
Code:

INCLUDE COND=(5,2,CH,EQ,'08')


The value '08' has to come from another file (named condition file)....

Is there any way to do that using JCL Utilities.
Last option will be to write an easytrieve or COBOL.
Back to top
View user's profile Send private message
jobin thomas

New User


Joined: 19 Aug 2008
Posts: 15
Location: Bangalore

PostPosted: Mon Oct 06, 2008 5:14 pm
Reply with quote

LRECL and date position are actually different.

Input File length : 150 [Date field for MM at position 30]
Condition File length: 150 [Date field for MM at position 30 and it has got just one record]
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Oct 06, 2008 10:14 pm
Reply with quote

Here's a DFSORT job that will do what you asked for:

Code:

//S1  EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN=...  condition file (FB/150)
//SORTOUT  DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD *
  OPTION COPY
* Create DFSORT Symbol for month as:
* TMON,'mm'
  INREC BUILD=(C'TMON,''',30,2,C'''',80:X)
/*
//S2       EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN   DD DSN=...  input file (FB/150)
//SORTOUT  DD DSN=...  output file (FB/150)
//SYSIN    DD *
* Use TMON symbol in INCLUDE statement.
  INCLUDE COND=(30,2,CH,EQ,TMON)
  SORT FIELDS=(26,8,CH,A)
/*
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 TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top