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
 

 

Writing records to different o/p files

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

New User


Joined: 28 Apr 2005
Posts: 99

PostPosted: Mon Aug 09, 2010 1:03 pm    Post subject: Writing records to different o/p files
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: 1187
Location: Bangalore,India

PostPosted: Mon Aug 09, 2010 1:13 pm    Post subject:
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 Moderator


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

PostPosted: Mon Aug 09, 2010 11:22 pm    Post subject:
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
Warnings : 1

New User


Joined: 28 Apr 2005
Posts: 99

PostPosted: Tue Aug 10, 2010 4:24 pm    Post subject:
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
Warnings : 1

New User


Joined: 28 Apr 2005
Posts: 99

PostPosted: Tue Aug 10, 2010 4:26 pm    Post subject:
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: 578
Location: USA

PostPosted: Tue Aug 10, 2010 4:44 pm    Post subject:
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    Post subject:
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
Warnings : 1

New User


Joined: 28 Apr 2005
Posts: 99

PostPosted: Wed Aug 11, 2010 11:13 am    Post subject:
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 Moderator


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

PostPosted: Wed Aug 11, 2010 9:56 pm    Post subject:
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:

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

New User


Joined: 28 Apr 2005
Posts: 99

PostPosted: Wed Aug 11, 2010 10:30 pm    Post subject:
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    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 Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Dynamic split of files under groups sril.krishy DFSORT/ICETOOL 4 Mon Apr 17, 2017 1:09 pm
No new posts Compare two files and subtract values ameetmund DFSORT/ICETOOL 7 Fri Mar 31, 2017 3:35 pm


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