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

Search for help on DFSORT !!!


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

New User


Joined: 04 Apr 2010
Posts: 13
Location: hangzhou, china

PostPosted: Fri Jul 08, 2011 4:27 pm
Reply with quote

I have 3 files with different record lengths (15,25,35) and different field layout. They all cotain one field called INVEST_TYPE in different column.

FILE01:LENGTH=15; Layout is like:
DCL 1 SHORT_EXT,
5 FUND_ID CHAR (04) INIT(''),
5 FILLER01 CHAR (01) INIT(';'),
5 CLIENT_ID CHAR (04) INIT(''),
5 FILLER02 CHAR (01) INIT(';'),
5 INVEST_TYPE CHAR(02) INIT('01'),
5 FILLER03 CHAR (03) INIT(' ;');

FILE02:LENGTH=25; Layout is like:
DCL 1 LONG_EXT,
5 FUND_ID CHAR (04) INIT(''),
5 FILLER01 CHAR (01) INIT(';'),
5 CLIENT_ID CHAR (04) INIT(''),
5 FILLER02 CHAR (01) INIT(';'),
5 REPT_DATE CHAR(09) INIT(''),
5 FILLER03 CHAR (01) INIT(';'),
5 INVEST_TYPE CHAR(02) INIT('02'),
5 FILLER04 CHAR (03) INIT(' ;');

FILE03:LENGTH=35;Layout is like:
DCL 1 OPTION_EXT,
5 FUND_ID CHAR (04) INIT(''),
5 FILLER01 CHAR (01) INIT(';'),
5 CLIENT_ID CHAR (04) INIT(''),
5 FILLER02 CHAR (01) INIT(';'),
5 DESCRIPTION CHAR (09) INIT(''),
5 FILLER03 CHAR (01) INIT(';'),
5 MAT_DATE CHAR(09) INIT(''),
5 FILLER04 CHAR (01) INIT(';'),
5 INVEST_TYPE CHAR(02) INIT('03'),
5 FILLER05 CHAR (03) INIT(' ;');

Now I want to sort the 3 files into 1 file with record length=36.
(a):If the record's INVEST_TYPE equals to '01', then add one byte 'S' as a leading indicator in the output file.
(b):If the record's INVEST_TYPE equals to '02', then add one byte 'L' as a leading indicator in the output file.
(c):If the record's INVEST_TYPE equals to '03', then add one byte 'O' as a leading indicator in the output file.

So my question is, is it possible to make this into reality by using DFSORT ?

I am wondering whether it's possible to get these 3 files record length in a control card so I can distinguish which file in then assign the correct leading indicator.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Fri Jul 08, 2011 6:58 pm
Reply with quote

icetree521,
icetree521 wrote:
Now I want to sort the 3 files into 1 file with record length=36.
(a):If the record's INVEST_TYPE equals to '01', then add one byte 'S' as a leading indicator in the output file.
(b):If the record's INVEST_TYPE equals to '02', then add one byte 'L' as a leading indicator in the output file.
(c):If the record's INVEST_TYPE equals to '03', then add one byte 'O' as a leading indicator in the output file.

So my question is, is it possible to make this into reality by using DFSORT ?

I am wondering whether it's possible to get these 3 files record length in a control card so I can distinguish which file in then assign the correct leading indicator.

What is the record layout/format of the final output file? Please provide which fields from all three files you want in the output file? Also provide where do you want to add leading indicator?

Do you have common key in all the 3 input files (FUND_ID and CLIENT_ID)?

Thanks,
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: Fri Jul 08, 2011 11:22 pm
Reply with quote

icetree521,

Cute kitten. icon_smile.gif Is it yours?

You need to do a better job of explaining what it is you're trying to do exactly before anyone can help you.

Please show an example of the records in each 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 files. If file1 can have duplicates within it, show that in your example. If file2 can have duplicates within it, show that in your example. If file3 can have duplicates within it, show that in your example.
Back to top
View user's profile Send private message
icetree521

New User


Joined: 04 Apr 2010
Posts: 13
Location: hangzhou, china

PostPosted: Sat Jul 09, 2011 6:39 pm
Reply with quote

sqlcode1 wrote:
icetree521,
icetree521 wrote:
Now I want to sort the 3 files into 1 file with record length=36.
(a):If the record's INVEST_TYPE equals to '01', then add one byte 'S' as a leading indicator in the output file.
(b):If the record's INVEST_TYPE equals to '02', then add one byte 'L' as a leading indicator in the output file.
(c):If the record's INVEST_TYPE equals to '03', then add one byte 'O' as a leading indicator in the output file.

So my question is, is it possible to make this into reality by using DFSORT ?

I am wondering whether it's possible to get these 3 files record length in a control card so I can distinguish which file in then assign the correct leading indicator.

What is the record layout/format of the final output file? Please provide which fields from all three files you want in the output file? Also provide where do you want to add leading indicator?

Do you have common key in all the 3 input files (FUND_ID and CLIENT_ID)?

Thanks,



Hi sqlcode1,

Thanks first. There is no a common record layout for the final output file. Each record of the final output layout is just the same as what it gets from the input record, except that it has one byte leading indicator('S','L' or 'O') in the first byte.
For example,

AAAA;0001;01 ; /**from FILE01**/
AAAB;0002;200908013;02 ; /**from FILE02**/
AAAC;0001;OPTIONSEC;200702017;03 ; /**from FILE03**/

I want the final output records like:
SAAAA;0001;01 ;
LAAAB;0002;200908013;02 ;
OAAAC;0001;OPTIONSEC;200702017;03 ;

which is in a format like: one leading indicator + input record format.
Please note the leading indicator is added in the beginning position. Both the 3 input files are begin with FUND_ID and CLIENT_ID, so (FUND_ID and CLIENT_ID) is the comment key.

Since the final output record length is 36, there will be 20 padding blanks for records from FILE01 and 10 padding blanks for records from FILE02.
Back to top
View user's profile Send private message
icetree521

New User


Joined: 04 Apr 2010
Posts: 13
Location: hangzhou, china

PostPosted: Sat Jul 09, 2011 6:46 pm
Reply with quote

Frank Yaeger wrote:
icetree521,

Cute kitten. :) Is it yours?

You need to do a better job of explaining what it is you're trying to do exactly before anyone can help you.

Please show an example of the records in each 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 files. If file1 can have duplicates within it, show that in your example. If file2 can have duplicates within it, show that in your example. If file3 can have duplicates within it, show that in your example.



Hi Frank Yaeger,

What a coincidence! You got a cute mouse and I got a cute kitten. :D

I hope i've made myself understood in the reply to sqlcode1.

Can you give me some suggestion to m ? thanks!
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Mon Jul 11, 2011 8:25 pm
Reply with quote

icetree521,
Because, all 3 files have different LRECL,I would personally write Cobol program instead of DFSort. However, below is DFSort solution to achieve the same. I assumed if INVEST_TYPE is not among 01,02,03 then you want to populate space in leading char.
Code:
//STEP0100 EXEC PGM=ICETOOL                                   
//TOOLMSG  DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*                                         
//IN1      DD INPUT FB/15,SHORT_EXT                           
//IN2      DD INPUT FB/25,LONG_EXT                             
//IN3      DD INPUT FB/35,OPTION_EXT                           
//OUT      DD OUTPUT FB/36,DISP=(MOD,CATLG),UNIT=SYSDA                                         
//TOOLIN   DD *                                               
  COPY FROM(IN1) TO(OUT) USING(CTL1)                           
  COPY FROM(IN2) TO(OUT) USING(CTL2)                           
  COPY FROM(IN3) TO(OUT) USING(CTL3)                           
//CTL1CNTL DD *                                               
 INREC IFTHEN=(WHEN=(11,2,CH,EQ,C'01'),BUILD=(C'S',1,15,20X)),
       IFTHEN=(WHEN=(11,2,CH,EQ,C'02'),BUILD=(C'L',1,15,20X)),
       IFTHEN=(WHEN=(11,2,CH,EQ,C'03'),BUILD=(C'O',1,15,20X)),
       IFTHEN=(WHEN=NONE,BUILD=(C' ',1,15,20X))               
//CTL2CNTL DD *                                               
 INREC IFTHEN=(WHEN=(21,2,CH,EQ,C'01'),BUILD=(C'S',1,25,10X)),
       IFTHEN=(WHEN=(21,2,CH,EQ,C'02'),BUILD=(C'L',1,25,10X)),
       IFTHEN=(WHEN=(21,2,CH,EQ,C'03'),BUILD=(C'O',1,25,10X)),
       IFTHEN=(WHEN=NONE,BUILD=(C' ',1,25,10X))               
//CTL3CNTL DD *                                               
 INREC IFTHEN=(WHEN=(31,2,CH,EQ,C'01'),BUILD=(C'S',1,35)),     
       IFTHEN=(WHEN=(31,2,CH,EQ,C'02'),BUILD=(C'L',1,35)),     
       IFTHEN=(WHEN=(31,2,CH,EQ,C'03'),BUILD=(C'O',1,35)),     
       IFTHEN=(WHEN=NONE,BUILD=(C' ',1,35))                   
/*                                                             


Thanks,
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: Tue Jul 12, 2011 1:05 am
Reply with quote

Quote:
What a coincidence! You got a cute mouse and I got a cute kitten. icon_biggrin.gif


Well, mine is actually Professor Rat in honor of my pet rats (I currently have 6).

Here's another way to do it with DFSORT/ICETOOL:

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN1      DD DSN=... input file1 (FB/15)
//IN2      DD DSN=... input file1 (FB/25)
//IN3      DD DSN=... input file1 (FB/35)
//OUT      DD DISP=MOD,DSN=...  output file (FB/36)
//TOOLIN   DD *
  COPY FROM(IN1) TO(OUT) USING(CTL1)
  COPY FROM(IN2) TO(OUT) USING(CTL2)
  COPY FROM(IN3) TO(OUT) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC BUILD=(1:11,2,CHANGE=(1,C'01',C'S',C'02',C'L',C'03',C'O'),
     NOMATCH=(C' '),1,15,36:X)
/*
//CTL2CNTL DD *
  INREC BUILD=(1:21,2,CHANGE=(1,C'01',C'S',C'02',C'L',C'03',C'O'),
     NOMATCH=(C' '),1,25,36:X)
/*
//CTL3CNTL DD *
  INREC BUILD=(1:31,2,CHANGE=(1,C'01',C'S',C'02',C'L',C'03',C'O'),
     NOMATCH=(C' '),1,35)
/*
Back to top
View user's profile Send private message
icetree521

New User


Joined: 04 Apr 2010
Posts: 13
Location: hangzhou, china

PostPosted: Tue Jul 12, 2011 6:55 pm
Reply with quote

Great job!!! It works now!!

Thanks to sqlcode1 and Frank Yaeger and also Professor Rat.
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 Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Search two or more word with FILEAID Compuware & Other Tools 15
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top