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
This topic is locked: you cannot edit posts or make replies. Need help on If condition continuatio... ashok_uddaraju CLIST & REXX 4 Fri May 19, 2017 8:55 am
No new posts How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am


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