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
 

 

Moving unmatched records into a new file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
notonly4u

New User


Joined: 26 Apr 2005
Posts: 87
Location: Hyderabad

PostPosted: Thu Oct 05, 2006 10:27 pm    Post subject: Moving unmatched records into a new file
Reply with quote

Dear all,

Could you please help on the following query?

Iam having an input file of LRECL=80.

If 1,1,CH,EQ,A => I need to write in an output file

In the unmatched records of the above condition, i need to check for

3,3,ch,eq,'ROT'

In the unmatched records of the above two conditions, I need to Check for some more conditions. Like this I have to write 40 conditions.

The query is, whether is there any way of writting the unmatched records of any include statement into another temporary file, without adding any OMIT condition and pointing to the output DSN?

This will be much helpful for me.

Thanks for your time in advance.

Regards
Tanden
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: Thu Oct 05, 2006 10:51 pm    Post subject:
Reply with quote

Quote:
The query is, whether is there any way of writting the unmatched records of any include statement into another temporary file, without adding any OMIT condition and pointing to the output DSN?


I don't understand what you mean by this. How can you write into a temporary file without pointing to the temporary file - how would you know where to write to? And I have no idea what you mean by "without any OMIT condition".

Perhaps if you showed an example of your input records and what you want for output, it would help clarify what you're trying to do.
Back to top
View user's profile Send private message
notonly4u

New User


Joined: 26 Apr 2005
Posts: 87
Location: Hyderabad

PostPosted: Fri Oct 06, 2006 11:30 am    Post subject: Re: Moving unmatched records into a new file
Reply with quote

Hello Frank,

Thanks much for the reply.

Suppose my input has some records as follows:

A1ROT654TANDENIBM
C1BOT354TANDENCSC
D1COT554TANDENIBM
E1DOT754TANDENTCS
F1POT954TANDENIBM

I need to write this into 5 different DSNs.

Output 1:
All the records with 1,1,CH = 'A'

Output 2:
In unmatched records in the above condition with 3,1 = B

Output 3:
In unmatched records in the above two conditions with 6,1 = 9

Output 4:
In unmatched records in all the above conditions with 15,3 = TCS

Output 5:
In unmatched records in all the above conditions with 9,6 = TANDEN

Due to some reasons I cant able to give the exact details of my DSN. Sorry for that. But in my scenario there are 20 such conditions and hence I need to write 20 output files. I tried in the following way:

OUTFIL FNAME=OUT1
Include Cond=(1,1,CH,EQ,A)

OUTFIL FNAME=OUT2
omit Cond=(1,1,CH,EQ,A)

Then I tried using the OUT2 as the input for the next sort.

So my query is, is there anyway that we could move the unmatched records into another temporaty file, upon which I can do further manipulation.

If you are still not clear, please make a note to me, So that I could try to explain more on my requirement.

Thanks much for your time.

Regards
Tanden
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: Fri Oct 06, 2006 8:43 pm    Post subject:
Reply with quote

I believe a DFSORT job like the following will do what you want. I assumed that your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes. Each IFTHEN clause sets a file number in position 81 if its condition is met. Once an IFTHEN clause is met for a record, IFTHEN processing stops for that record, so this has the effect of checking "unmatched" records for the conditions. The OUTFIL statements then use the file number in 81 to write the selected records to each file.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=... input file (FB/80)
//OUT1 DD DSN=...   output file1 (FB/80)
//OUT2 DD DSN=...   output file2 (FB/80)
//OUT3 DD DSN=...   output file3 (FB/80)
//OUT4 DD DSN=...   output file4 (FB/80)
//OUT5 DD DSN=...   output file5 (FB/80)
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'A'),OVERLAY=(81:C'1')),
        IFTHEN=(WHEN=(3,1,CH,EQ,C'B'),OVERLAY=(81:C'2')),
        IFTHEN=(WHEN=(6,1,CH,EQ,C'9'),OVERLAY=(81:C'3')),
        IFTHEN=(WHEN=(15,3,CH,EQ,C'TCS'),OVERLAY=(81:C'4')),
        IFTHEN=(WHEN=(9,6,CH,EQ,C'TANDEN'),OVERLAY=(81:C'5'))
  OUTFIL FNAMES=OUT1,INCLUDE=(81,1,CH,EQ,C'1'),BUILD=(1,80)
  OUTFIL FNAMES=OUT2,INCLUDE=(81,1,CH,EQ,C'2'),BUILD=(1,80)
  OUTFIL FNAMES=OUT3,INCLUDE=(81,1,CH,EQ,C'3'),BUILD=(1,80)
  OUTFIL FNAMES=OUT4,INCLUDE=(81,1,CH,EQ,C'4'),BUILD=(1,80)
  OUTFIL FNAMES=OUT5,INCLUDE=(81,1,CH,EQ,C'5'),BUILD=(1,80)
/*
Back to top
View user's profile Send private message
notonly4u

New User


Joined: 26 Apr 2005
Posts: 87
Location: Hyderabad

PostPosted: Fri Oct 06, 2006 10:08 pm    Post subject: Re: Moving unmatched records into a new file
Reply with quote

Hello Frank,

Thank you very much for the reply.

This was really working great.

Regards
Tanden
Back to top
View user's profile Send private message
notonly4u

New User


Joined: 26 Apr 2005
Posts: 87
Location: Hyderabad

PostPosted: Fri Nov 24, 2006 11:39 pm    Post subject:
Reply with quote

Hello Frank,

Iam having one more query on the same scenario.

I have multiple records in a file which has got different dates starting from tomorrow to the next 21 days. I need to separate the records in such a way that each day?s records are stored in different files. I mean 21 different output files.

The date format is YYYYWWD(Year, week, day) and it is CHAR(7). The LRECL of the file is 80, and the starting position of the date field is 66.

Can you please advice me how can I acheive this in SORT?

Thanks much for your time.

Regards
Tanden
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: Sat Nov 25, 2006 2:35 am    Post subject:
Reply with quote

If you can hardcode the dates, then you can use something like this:

Code:

  OPTION COPY
  OUTFIL FNAMES=OUT01,INCLUDE=(66,7,CH,EQ,C'2006501')
  OUTFIL FNAMES=OUT02,INCLUDE=(66,7,CH,EQ,C'2006502')
  ...


If you need the date constants generated dynamically, DFSORT does not have any built-in functions to do that for a yyyywwd date. It can do it for yyyymmdd (DATE1+1,..., DATE1+21) dates and for yyyyddd (DATE3+1, DATE3+21) dates, but not for yyyywwd dates.
Back to top
View user's profile Send private message
notonly4u

New User


Joined: 26 Apr 2005
Posts: 87
Location: Hyderabad

PostPosted: Tue Nov 28, 2006 4:29 pm    Post subject:
Reply with quote

Hello Frank,

Thanks much for the time and information.

I will try to handle the same using some programs since the date format is different.

Regards
Tanden
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 Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am


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