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

Writing records to different o/p files


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Deepa.m

New User


Joined: 28 Apr 2005
Posts: 99

PostPosted: Mon Aug 09, 2010 1:03 pm
Reply with quote

All,

I am looking for a solution where I need to read the i/p file and write the o/p records as per below logic

when code='BOC' and Ind =(R or C) then write to file1 and file2
when IND=R and status code= O write to file1

when IND=C and status code = O write to File 2

Can i write the selected records to 2 files at the same time?

Thanks,
Deepa
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Mon Aug 09, 2010 1:13 pm
Reply with quote

Hello Deepa,

Please provide us sample input , output as well Sort Utility running on ur system.
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 Aug 09, 2010 11:22 pm
Reply with quote

Deepa,

Please show an example of the records in your input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input file.

Quote:
Can i write the selected records to 2 files at the same time?


Yes, with DFSORT OUTFIL statements.
Back to top
View user's profile Send private message
Deepa.m

New User


Joined: 28 Apr 2005
Posts: 99

PostPosted: Tue Aug 10, 2010 4:24 pm
Reply with quote

Hi all

My apologies. Here are the details

LRECL = 61

Code:
field name    position  length format
CODE           12          3        ch
IND              14          1        ch
STATUS        15          1        ch


IF CODE='BOC' and IND =(R or C) then write to file1 and file2

else

if IND=R and STATUS= O write to file1


else

if IND=C and STATUS = O write to File 2

example i/p

48294843490BOC0R0O00000000000

48294843490[b]CAD
0R0O00000000000

48294843490[b]COL
0C0O00000000000

48294843490[b]CAM
0C0O00000000000

48294843490[b]CAM
0C0P00000000000



file 1

48294843490[b]BOC
0R0O00000000000

48294843490[b]CAD
0R0O00000000000

file 2

48294843490BOC0R0O00000000000

48294843490[b]COL
0C0O00000000000

48294843490[b]CAM
0C0O00000000000



Thanks,
Deepa.

Back to top
View user's profile Send private message
Deepa.m

New User


Joined: 28 Apr 2005
Posts: 99

PostPosted: Tue Aug 10, 2010 4:26 pm
Reply with quote

example i/p

48294843490BOC0R0O00000000000

48294843490CAD0R0O00000000000

48294843490COL0C0O00000000000

48294843490CAM0C0O00000000000

48294843490CAM0C0P00000000000



file 1

48294843490BOC0R0O00000000000

48294843490CAD0R0O00000000000

file 2

48294843490BOC0R0O00000000000

48294843490COL0C0O00000000000

48294843490CAM0C0O00000000000
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Tue Aug 10, 2010 4:44 pm
Reply with quote

Deepa,

From what you have shown in the sample input seems like your Fields are overlapping.
1) code field ends at 14th position but then you show your indicator at 14th position as well.

2) You mentioned status is at 15th position as compared to 16th position shown by you in the sample data.

Thanks,
Back to top
View user's profile Send private message
smijoss

Active User


Joined: 30 Aug 2007
Posts: 114
Location: pune

PostPosted: Tue Aug 10, 2010 4:54 pm
Reply with quote

with hint Frank gave a good 10 minutes read could have solved your problem

Code:

  OUTFIL FNAMES=FILE1,
   INCLUDE=((12,3,CH,C'BOC',AND,16,1,SS,C'RC'),OR,
                  (16,1,CH,EQ,C'R',AND,18,1,CH,EQ,C'O'))

  OUTFIL FNAMES=FILE2,
   INCLUDE=((12,3,CH,C'BOC',AND,16,1,SS,C'RC'),OR,
                  (16,1,CH,EQ,C'C',AND,18,1,CH,EQ,C'O'))


sqlcode1 - good catch
Back to top
View user's profile Send private message
Deepa.m

New User


Joined: 28 Apr 2005
Posts: 99

PostPosted: Wed Aug 11, 2010 11:13 am
Reply with quote

I was specifically looking if there is any way to write the output records to 2 files when it matches instead of repeating the condition check twice.

OUTFIL FNAMES=FILE1,
INCLUDE=((12,3,CH,C'BOC',AND,16,1,SS,C'RC'),OR,
(16,1,CH,EQ,C'R',AND,18,1,CH,EQ,C'O'))

OUTFIL FNAMES=FILE2,
INCLUDE=((12,3,CH,C'BOC',AND,16,1,SS,C'RC'),OR,
(16,1,CH,EQ,C'C',AND,18,1,CH,EQ,C'O'))

Please ignore my example if that is misleading.

something like OUTFIL FNAMES=FILE1,FILE2,INCLUDE=((12,3,CH,C'BOC',AND,16,1,SS,C'RC')

Thanks,
Deepa.
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: Wed Aug 11, 2010 9:56 pm
Reply with quote

Code:

   OUTFIL FNAMES=(FILE1,FILE2),...


You could have looked this up yourself in the DFSORT books which are available free online from:

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080
Back to top
View user's profile Send private message
Deepa.m

New User


Joined: 28 Apr 2005
Posts: 99

PostPosted: Wed Aug 11, 2010 10:30 pm
Reply with quote

Thank u


I will do a initial research before raising my question

Thanks to all for your patience
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top