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
 

 

Write in separate output files based on different scenarios.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
AJAYREDDY

New User


Joined: 17 Feb 2007
Posts: 47
Location: USA

PostPosted: Mon Nov 02, 2009 11:28 pm    Post subject: Write in separate output files based on different scenarios.
Reply with quote

I have Input file INFILE with record length 120 and Key is at position 64 with X(10).

This file is already sorted on Key field.

I need to write records in separate output files based on below scenarios. I need to compare the Key field and the field at position 10 (where it contains either ‘E’ or ‘F’). No other values are present at this location.

Examples:

AAAA05038 -- has 2 ‘E’ records with no matching ‘F’. These type of records should write in separate file OUTFILE1

BBBB05101, EEEE05145, GGGG05237 – has only one ‘E’ record with no matching ‘F’. These type of records should write in separate file OUTFILE2

CCCC05102 and FFFF05195 – has 2 ‘E’ and 1 ‘F’ record. These type of records should write in separate file OUTFILE3

DDDD05136 and IIII00062 - has matching 1 to 1 ‘E’ and ‘F’ record. These type of records should write in separate file OUTFILE4

HHHH00025 – has only one ‘F’ record with no matching ‘E’. These type of records should write in separate file OUTFILE5

The above are the only scenario’s in the INFILE. There are no other scenarios. Can anyone please let me know if this can be done through DFSORT?

Thanks
Code:
091008X69E                                                     AAAA05038
091016X69E                                                     AAAA05038
091007X69E                                                     BBBB05101
091025X69E                                                     CCCC05102
091029X69E                                                     CCCC05102
091030X69F                                                     CCCC05102
091021X69E                                                     DDDD05136
091022X69F                                                     DDDD05136
091015X69E                                                     EEEE05145
091025X69E                                                     FFFF05195
091029X69E                                                     FFFF05195
091030X69F                                                     FFFF05195
091008X69E                                                     GGGG05237
091027X69F                                                     HHHH00025
091020X69E                                                     IIII00062
091021X69F                                                     IIII00062
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: Tue Nov 03, 2009 12:47 am    Post subject:
Reply with quote

So you can have 1, 2 or 3 records with each key, and the rules for which records go to which files are as follows?

OUTFIL1 - 2 records with key - 2 'E'
OUTFIL2 - 1 record with key - 1 'E'
OUTFIL3 - 3 records with key - 2 'E', 1 'F'
OUTFIL4 - 2 records with keys - 1 'E', 1 'F'
OUTFIL5 - 1 record with key - 1 'F'

And there are no other cases, like these?

2 records with key - 2 'F'
3 records with key - 1 'E', 2'F'
...
Back to top
View user's profile Send private message
AJAYREDDY

New User


Joined: 17 Feb 2007
Posts: 47
Location: USA

PostPosted: Tue Nov 03, 2009 1:43 am    Post subject: Reply to: Write in separate output files based on different
Reply with quote

Frank,

Yes, there are no other cases like these.

2 records with key - 2 'F'
3 records with key - 1 'E', 2'F'

Only the 5 OUTFIL conditions that I sent are possible.

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

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Nov 03, 2009 2:13 am    Post subject: Reply to: Write in separate output files based on different
Reply with quote

Code:

//STEP0100 EXEC PGM=ICETOOL       
//TOOLMSG  DD SYSOUT=*           
//DFSMSG   DD SYSOUT=*           
//IN       DD DSN=your input fb 120 byte file,DISP=SHR
//T1       DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)           
//OUT1     DD SYSOUT=*                                               
//OUT2     DD SYSOUT=*                                               
//OUT3     DD SYSOUT=*                                               
//OUT4     DD SYSOUT=*                                               
//OUT5     DD SYSOUT=*                                               
//TOOLIN   DD *                                                       
  COPY FROM(IN) USING(CTL1)                                           
  SORT FROM(T1) USING(CTL2)
//*                                           
//CTL1CNTL DD *                                                       
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(121:2C'0')),                       
  IFTHEN=(WHEN=(10,1,CH,EQ,C'E'),OVERLAY=(121:C'1')),                 
  IFTHEN=(WHEN=(10,1,CH,EQ,C'F'),OVERLAY=(122:C'1'))                 
  OUTFIL FNAMES=T1,REMOVECC,BUILD=(1,120,3X),                         
  SECTIONS=(64,9,                                                     
  TRAILER3=(64:64,9,121:TOT=(121,1,ZD,EDIT=(T)),                     
                        TOT=(122,1,ZD,EDIT=(T)),C'T'))               
//*                                                                   
//CTL2CNTL DD *                                                       
  SORT FIELDS=(64,9,CH,A,123,1,CH,D),EQUALS                           

  OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(123,1,CH,EQ,C'T'),PUSH=(121:121,2))
  OUTFIL FNAMES=OUT1,BUILD=(1,120),                                   
  INCLUDE=(121,2,ZD,EQ,20,AND,123,1,CH,EQ,C' ')                       
  OUTFIL FNAMES=OUT2,BUILD=(1,120),                                   
  INCLUDE=(121,2,ZD,EQ,10,AND,123,1,CH,EQ,C' ')                       
  OUTFIL FNAMES=OUT3,BUILD=(1,120),                                   
  INCLUDE=(121,2,ZD,EQ,21,AND,123,1,CH,EQ,C' ')                       
  OUTFIL FNAMES=OUT4,BUILD=(1,120),                                   
  INCLUDE=(121,2,ZD,EQ,11,AND,123,1,CH,EQ,C' ')                       
  OUTFIL FNAMES=OUT5,BUILD=(1,120),                                   
  INCLUDE=(121,2,ZD,EQ,01,AND,123,1,CH,EQ,C' ')                       
//*
Back to top
View user's profile Send private message
AJAYREDDY

New User


Joined: 17 Feb 2007
Posts: 47
Location: USA

PostPosted: Tue Nov 03, 2009 3:09 am    Post subject: Reply to: Write in separate output files based on different
Reply with quote

Skolusu,

It is giving below error with return code 16 under DFSMSG step. Maybe it is problem with WHEN=GROUP identifier.


WER428I CALLER-PROVIDED IDENTIFIER IS "0001"
WER108I IN : RECFM=FB ; LRECL= 120; BLKSIZE= 27960
WER257I INREC RECORD LENGTH = 122
WER238I POTENTIALLY INEFFICIENT USE OF INREC
WER110I T1 : RECFM=FB ; LRECL= 123; BLKSIZE= 27921
WER405I T1 : DATA RECORDS OUT 6476; TOTAL RECORDS OUT 8993
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
WER054I RCD IN 6476, OUT 6476

Code:
CTL2CNTL :                                                             
  SORT FIELDS=(64,9,CH,A,123,1,CH,D),EQUALS                           
  OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(123,1,CH,EQ,C'T'),PUSH=(121:121,2))
                      *                                               
  OUTFIL FNAMES=OUT1,BUILD=(1,120),                                   
  INCLUDE=(121,2,ZD,EQ,20,AND,123,1,CH,EQ,C' ')                       
  OUTFIL FNAMES=OUT2,BUILD=(1,120),                                   
  INCLUDE=(121,2,ZD,EQ,10,AND,123,1,CH,EQ,C' ')                       
  OUTFIL FNAMES=OUT3,BUILD=(1,120),                                   
  INCLUDE=(121,2,ZD,EQ,21,AND,123,1,CH,EQ,C' ')                       
  OUTFIL FNAMES=OUT4,BUILD=(1,120),                                   
  INCLUDE=(121,2,ZD,EQ,11,AND,123,1,CH,EQ,C' ')                       
  OUTFIL FNAMES=OUT5,BUILD=(1,120),                                   
  INCLUDE=(121,2,ZD,EQ,01,AND,123,1,CH,EQ,C' ')                       
WER428I  CALLER-PROVIDED IDENTIFIER IS "0002"                         
WER268A  OUTREC STATEMENT  : SYNTAX ERROR                             
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                         
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Nov 03, 2009 3:14 am    Post subject:
Reply with quote

Hello,

Your system uses Syncsort, not DFSORT.

Suggest you talk with management to get the product upgraded.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6967
Location: porcelain throne

PostPosted: Tue Nov 03, 2009 3:19 am    Post subject:
Reply with quote

deleted by DBZ.

man, i am even slower than DS.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Nov 03, 2009 3:25 am    Post subject: Reply to: Write in separate output files based on different
Reply with quote

Me too. . . icon_biggrin.gif
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: Tue Nov 03, 2009 4:09 am    Post subject:
Reply with quote

AJAYREDDY,

Kolusu's job works fine with DFSORT. The WER messages indicate you're using Syncsort, not DFSORT. Kolusu and I are DFSORT developers. DFSORT and Syncsort are competitive products. We're happy to answer questions on DFSORT and DFSORT's ICETOOL, but we don't answer questions on Syncsort.
Back to top
View user's profile Send private message
AJAYREDDY

New User


Joined: 17 Feb 2007
Posts: 47
Location: USA

PostPosted: Tue Nov 03, 2009 8:12 pm    Post subject: Reply to: Write in separate output files based on different
Reply with quote

Thanks to all for the help. I will talk with management about DFSORT product.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Nov 03, 2009 9:02 pm    Post subject:
Reply with quote

Hello,

Quote:
I will talk with management about DFSORT product.
Why? Hopefully the management of that organization will not change products because some programmer wants to. . .

Suggest getting the Syncsort product up to current level. . .
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
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 Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts Dynamic split of files under groups sril.krishy DFSORT/ICETOOL 4 Mon Apr 17, 2017 1:09 pm


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