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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: How to Sort a flat file using condition from an input file!
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    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Mon Oct 06, 2008 10:14 pm    Post subject:
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    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 SSH - known_hosts file configuration vasanthz All Other Mainframe Topics 2 Wed Jul 26, 2017 2:10 am
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm


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