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 Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm


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