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

Create output header with ICETOOL


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

New User


Joined: 16 Oct 2012
Posts: 37
Location: INDIA

PostPosted: Fri Feb 01, 2013 12:39 am
Reply with quote

I have a requirement to create one output file with a header, where inputs are coming from 3 separate files. These 3 input files have millions of record and one common key KKX-ID.

All the numeric fields are binary.

1)The three input file needs to be sorted in order of KKX-ID.
2)All KKX-ID from file1 should be written into output file.
3)Required field from file1 needs in the output file: KKX-ID(1:4), DKD(10:, DKD-DESC(23:30 ),E-BUD-IND(206:1)
4)Required field from file2 needs in the output file: KKX-ID(5:4), KKX-NUMBER(23:30 ),VDI-IND(18:1)
5)Required field from file3 needs in the output file: KKX-ID(1:4),KESK-AVT-AMNT(59:6)
6)The output fields should be in '|'delimited order(input fields are not in delimited order, just for display we have put it)
7)If the KKX-ID is not found in file2 or file3, numeric field needs to be written to output file with zeros & characters with spaces.
8)The output file needs to be sorted by DKD.

Please find below the sample input and output and also the ICETOOL code that i have written which is not working as desired.

Would be glad if you could help me solve this asap as it has really very urgent for me.

Thanks in advance !!

File1: FB record length 500

Required Field position in file:

Code:
KKX-ID|DKD |DKD-DESC |E-BUD-IND |
(1:4) |(18:5) |(23:30 ) | (206:1) |
345|93136962 |+PLT EMMA GLTR ITY |Y |
1166|89947260 |SS FLUTTER SLEEVE TOP |N |
1357|90349437 |FAS-PNT 2PKT SLUB-GRAY|Y |
2149|87963278 |VINTG LACE X- |Y |



File2: FB record length 250

Required Field position in file:

Code:
KKX-ID|KKX-NUMBER |VDI-IND|
(5:4)|(10: |(18:1)
345| 400931369625|N |
1166| 809709671623|N |
1200| 400879632782|N |
1357| 400903494379|N |
1949| 400879632782|N |


File3: FB record length 173

Required Field position in file:

Code:
KKX-ID| KESK-AVT-AMNT |
(5:4)|(59:6) |
345|0000017.100 |
1166|0000018.100 |
1266|0000018.100 |
2149|0000018.100 |
2222|0000018.100 |




output:
Code:
KKX-ID|KKX-NUMBER |DKD |DKD-DESC |E-BUD-IND |VDI-IND|KESK-AVT-AMNT
345| 400931369625|93136962 |+PLT EMMA GLTR ITY |Y |N |0000017.100
1166| 809709671623|89947260 |SS FLUTTER SLEEVE TOP |Y |N |0000018.100
1357| 400903494379|90349437 |FAS-PNT 2PKT SLUB-GRAY|Y |N |0000000.000
2149| 000000000000|87963278 |VINTG LACE X- |Y | |0000018.100





Our Code:

Code:
//PLOMSHS JOB SSSSS,'PAAA0T',
// CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID
//******************************************************************
//* S001 -
//******************************************************************
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=TKMA.IKRTQ034.TEST.OUT11,
// DISP=SHR
//IN2 DD DSN=TKMA.IKRTQ034.TEST.OUT22,
// DISP=SHR
//IN3 DD DSN=TKMA.IKRTQ034.TEST.OUT33,
// DISP=SHR
//T1 DD DSN=&&T1,UNIT=CART,BUFNO=20,VOL=(,,,99),RECFM=FB,LRECL=500
//T2 DD DSN=&&T2,UNIT=CART,BUFNO=20,VOL=(,,,99),RECFM=FB,LRECL=250
//T3 DD DSN=&&T3,UNIT=CART,BUFNO=20,VOL=(,,,99),RECFM=FB,LRECL=173
//T4 DD DSN=&&T4,UNIT=CART,BUFNO=20,VOL=(,,,99),RECFM=FB,LRECL=90
//OUT DD DSN=TKMA.IKRTQ034.OUTPUTXT,DISP=(NEW,CATLG,DELETE),
// UNIT=CART,BUFNO=20,VOL=(,,,99),RECFM=FB,LRECL=90
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T2) USING(CTL2)
COPY FROM(IN3) TO(T3) USING(CTL3)
COPY FROM(T1) TO(T4) USING(CTL4)
COPY FROM(T4) TO(OUT) USING(CTL5)
//CTL1CNTL DD *
SORT FIELDS=(1,4,BI,A)
//CTL2CNTL DD *
SORT FIELDS=(5,4,BI,A)
//CTL3CNTL DD *
SORT FIELDS=(1,4,BI,A)
SUM FIELDS=(NONE)
/*
//CTL4CNTL DD *
JOINKEYS F1=T1,FIELDS=(1,4,BI,A)
JOINKEYS F2=T2,FIELDS=(5,4,BI,A)
JOIN UNPAIRED,F1,F2
REFORMAT FIELDS=(F1:1,4,F1:18,5,F1:23,30,F1:206,1,F2:10,8,F2:18,1)
OPTION COPY
OUTREC OVERLAY=(90:X)
//CTL5CNTL DD *
JOINKEYS F1=T4,FIELDS=(1,4,BI,A),SORTED
JOINKEYS F2=T3,FIELDS=(1,4,BI,A)
JOIN UNPAIRED,F1,F2
REFORMAT FIELDS=(F1:1,49,F2:59,6)
OPTION COPY
/*


Code'd and re-titled
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Fri Feb 01, 2013 1:34 am
Reply with quote

It may be urgent for you but it is not urgent for anyone else. Here we do things IF we want, WHEN we want, IF we want at all. For urgent you pay someone.

You have also been here long enough to know that you should use code tags to present stuf that needs a fixed pitch font. Nicely presented problems are more likely to be looked at.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Feb 01, 2013 2:03 am
Reply with quote

Urgent to me describes a road accident, where children are involved, the vehicle is engulfed in flames and the kids can't get out.

Questions such as this, not so much.... icon_rolleyes.gif
Back to top
View user's profile Send private message
frozenblood
Warnings : 1

New User


Joined: 16 Oct 2012
Posts: 37
Location: INDIA

PostPosted: Fri Feb 01, 2013 2:14 am
Reply with quote

I think we are deviating from the topic here, i am here for help and not to laugh at somebody or pass remarks i guess this forum is also for the same icon_smile.gif icon_smile.gif

Appreciate if you guide me through
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Feb 01, 2013 2:28 am
Reply with quote

we are just dealing with Your bad manners ...
of claiming urgency
and posting a title in upper case which means shouting
Back to top
View user's profile Send private message
frozenblood
Warnings : 1

New User


Joined: 16 Oct 2012
Posts: 37
Location: INDIA

PostPosted: Fri Feb 01, 2013 2:32 am
Reply with quote

enrico-sorichetti wrote:
we are just dealing with Your bad manners ...
of claiming urgency
and posting a title in upper case which means shouting


sorry bout that !!

But mainframe is case-insensitive icon_smile.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Feb 01, 2013 2:35 am
Reply with quote

Quote:
But mainframe is case-insensitive

unfortunately You are wrong in both cases
mainframe and forum netiquette
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Feb 01, 2013 2:41 am
Reply with quote

frozenblood wrote:
I think we are deviating from the topic here, i am here for help and not to laugh at somebody or pass remarks i guess this forum is also for the same icon_smile.gif icon_smile.gif



1. If you are seeking help, please learn to be courteous and NOT rush people to help you out. You canNOT push your deadlines on to the people who help here voluntarily in their free time. Adding a smiley emoticon at the end of sentence doesn't help.

2. Please do NOT send me private messages with the same information for a topic you already posted. If you posted here it is more than enough.

3. Learn to use code tags which retains the spacing so that it is easy to read.

4. You description says "All the numeric fields are binary." but your file3 has KESK-AVT-AMNT where you show amounts with decimal point. Is the amount a packed decimal field?

5. You claim that the job you tried doesn't work. Ofcourse it doesn't work as you seem to invent your own syntax for JOINKEYS where you are passing the format.

If you really need please provide the following details.

a. What is the common key to match ? KKX-ID? If so what is the COBOL declaration of it. ex: KKX-ID PIC S9(09) COMP.
b. Show us the COBOL declaration for ALL the numeric fields.
c. Do you need the final output in readable format? Binary/packed decimal fields are not readable.
d. Do you really need the final output to be sorted on DKD? or is it KKX-ID?
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Feb 01, 2013 2:59 am
Reply with quote

Forgot to ask.

Does any of the files have Duplicates on the matching key? If so do you want to create a Cartesian join records as output?
Back to top
View user's profile Send private message
frozenblood
Warnings : 1

New User


Joined: 16 Oct 2012
Posts: 37
Location: INDIA

PostPosted: Fri Feb 01, 2013 3:05 am
Reply with quote

Skolusu wrote:
frozenblood wrote:
I think we are deviating from the topic here, i am here for help and not to laugh at somebody or pass remarks i guess this forum is also for the same icon_smile.gif icon_smile.gif



1. If you are seeking help, please learn to be courteous and NOT rush people to help you out. You canNOT push your deadlines on to the people who help here voluntarily in their free time. Adding a smiley emoticon at the end of sentence doesn't help.

2. Please do NOT send me private messages with the same information for a topic you already posted. If you posted here it is more than enough.

3. Learn to use code tags which retains the spacing so that it is easy to read.

4. You description says "All the numeric fields are binary." but your file3 has KESK-AVT-AMNT where you show amounts with decimal point. Is the amount a packed decimal field?

5. You claim that the job you tried doesn't work. Ofcourse it doesn't work as you seem to invent your own syntax for JOINKEYS where you are passing the format.

If you really need please provide the following details.

a. What is the common key to match ? KKX-ID? If so what is the COBOL declaration of it. ex: KKX-ID PIC S9(09) COMP.
b. Show us the COBOL declaration for ALL the numeric fields.
c. Do you need the final output in readable format? Binary/packed decimal fields are not readable.
d. Do you really need the final output to be sorted on DKD? or is it KKX-ID?


I sincerely apologize for that.

Below are the answers:

a. What is the common key to match ? KKX-ID? If so what is the COBOL declaration of it. ex: KKX-ID PIC S9(09) COMP.
Answer:
Yes KKX-ID PIC S9(09) COMP.

b. Show us the COBOL declaration for ALL the numeric fields.
KKX-ID PIC S9(09) COMP.
DKD PIC S9(08)V COMP-3.
KESK-AVT-AMNT PIC S9(7)V9(3) COMP-3
KKX-NUMBER PIC S9(15)V COMP-3.

c. Do you need the final output in readable format? Binary/packed decimal fields are not readable.
Yes We need it in readable format.

d. Do you really need the final output to be sorted on DKD? or is it KKX-ID?
We need the output sorted on DKD.

We also need the header to be written in the output file:
KKX-ID|KKX-NUMBER |DKD |DKD-DESC |E-BUD-IND |VDI-IND|KESK-AVT-AMNT

Thanks for your time.
Back to top
View user's profile Send private message
frozenblood
Warnings : 1

New User


Joined: 16 Oct 2012
Posts: 37
Location: INDIA

PostPosted: Fri Feb 01, 2013 3:16 am
Reply with quote

Skolusu wrote:
Forgot to ask.

Does any of the files have Duplicates on the matching key? If so do you want to create a Cartesian join records as output?


Yes file2 and file3 have duplicate records. We do not want cartesian join records.

We want to have the output for all the KKX-ID of file1. If KKX-ID not found in file2 or file3, the numeric fields will be written with Zeros and characters with spaces.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Feb 01, 2013 3:25 am
Reply with quote

frozenblood wrote:

b. Show us the COBOL declaration for ALL the numeric fields.
KKX-ID PIC S9(09) COMP.
DKD PIC S9(08)V COMP-3.
KESK-AVT-AMNT PIC S9(7)V9(3) COMP-3
KKX-NUMBER PIC S9(15)V COMP-3.

Yes We need it in readable format.
We also need the header to be written in the output file:
KKX-ID|KKX-NUMBER |DKD |DKD-DESC |E-BUD-IND |VDI-IND|KESK-AVT-AMNT

Thanks for your time.


You aren't consistent with your requirements.

1. Where did this new KKX-NUMBER field come from? Which file has this field? what is the position of this new field?

2. When you say you want the output in readable format , what is the length of each field in the readable format? Do you need the leading zeros for Numeric fields? or should they be suppressed?

3. Do you need the header once at the top? or do you need it on every page?
Back to top
View user's profile Send private message
frozenblood
Warnings : 1

New User


Joined: 16 Oct 2012
Posts: 37
Location: INDIA

PostPosted: Fri Feb 01, 2013 3:42 am
Reply with quote

Skolusu wrote:
frozenblood wrote:

b. Show us the COBOL declaration for ALL the numeric fields.
KKX-ID PIC S9(09) COMP.
DKD PIC S9(08)V COMP-3.
KESK-AVT-AMNT PIC S9(7)V9(3) COMP-3
KKX-NUMBER PIC S9(15)V COMP-3.

Yes We need it in readable format.
We also need the header to be written in the output file:
KKX-ID|KKX-NUMBER |DKD |DKD-DESC |E-BUD-IND |VDI-IND|KESK-AVT-AMNT

Thanks for your time.


You aren't consistent with your requirements.

1. Where did this new KKX-NUMBER field come from? Which file has this field? what is the position of this new field?

The KKX-NUMBER is present in the file2 as mentioned above.
File2: FB record length 250

Required Field position in file:

KKX-ID|KKX-NUMBER |VDI-IND|
(5:4)|(10:8) |(18:1)
345| 400931369625|N |


2. When you say you want the output in readable format , what is the length of each field in the readable format? Do you need the leading zeros for Numeric fields? or should they be suppressed?
The desired output is:

KKX-ID PIC Z(10).
FILLER PIC X(01)
VALUE '|'.
KKX-NUMBER PIC Z(15).
FILLER PIC X(01)
VALUE '|'.
DKD PIC Z(08).
FILLER PIC X(01)
VALUE '|'.
DKD-DESC PIC X(30).
FILLER PIC X(01)
VALUE '|'.
E-BUD-IND PIC X(01).
FILLER PIC X(01)
VALUE '|'.
VDI-IND PIC X(01).
FILLER PIC X(01)
VALUE '|'.
KESK-AVT-AMNT PIC 9(07).9(03).
if you find something wrong please feel free to correct it.
3. Do you need the header once at the top? or do you need it on every page?

The header should be at the top only.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Feb 01, 2013 4:44 am
Reply with quote

Use the following DFSORT JCL which will give you the desired results.

Code:

//STEP0100 EXEC PGM=ICETOOL                                     
//TOOLMSG  DD SYSOUT=*                                           
//DFSMSG   DD SYSOUT=*                                           
//IN500    DD DISP=SHR,DSN=Your Input FB 500 byte file
//IN250    DD DISP=SHR,DSN=Your Input FB 250 byte file
//IN173    DD DISP=SHR,DSN=Your Input FB 173 byte file
//IN049    DD DSN=&&IN049,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)   
//OUT      DD SYSOUT=*                                           
//TOOLIN   DD *                                                 
  COPY JKFROM USING(CTL1)                                       
  COPY JKFROM USING(CTL2)                             
//*           
//CTL1CNTL DD *                                                 
  JOINKEYS F1=IN500,FIELDS=(1,4,A),TASKID=T1                     
  JOINKEYS F2=IN250,FIELDS=(1,4,A),TASKID=T1                     
  JOIN UNPAIRED,F1                                               
  REFORMAT FIELDS=(F1:1,4,F2:5,8,F1:5,36,F2:13,1,?)             
  INREC IFOUTLEN=49,                                             
  IFTHEN=(WHEN=(50,1,CH,EQ,C'1'),OVERLAY=(5:+0,TO=PD,LENGTH=8)) 
  OUTFIL FNAMES=IN049                                           
//*                                                             
//T1F1CNTL DD *                                                 
  INREC BUILD=(1,4,18,35,206,1)                                 
//*                                                             
//T1F2CNTL DD *                                                 
  INREC BUILD=(5,4,10,9)                                         
  SUM FIELDS=NONE                                               
//*
//CTL2CNTL DD *                                                 
  JOINKEYS F1=IN049,FIELDS=(1,4,A),SORTED,NOSEQCK,TASKID=T2     
  JOINKEYS F2=IN173,FIELDS=(1,4,A),TASKID=T2                   
  JOIN UNPAIRED,F1                                             
  REFORMAT FIELDS=(F1:1,49,F2:5,6,?)                           
  SORT FIELDS=(13,5,PD,A)                                       
  OUTFIL FNAMES=OUT,REMOVECC,                                   
  HEADER1=(C'  KKX-IND |  KKX-NUMBER   |  DKD   |',11X,         
           C'DKD-DESC',11X,C'|E-BUD-IND|VDI-IND|KESK-AVT-AMNT'),
  IFOUTLEN=99,IFTHEN=(WHEN=INIT,                               
  BUILD=(01,4,BI,M10,LENGTH=10,      $ KKX-ID                   
         C'|',                       $ DELIM                   
         05,8,PD,M10,LENGTH=15,      $ KKX-NUMBER               
         C'|',                       $ DELIM                   
         13,5,PD,M10,LENGTH=08,      $ DKD                     
         C'|',                       $ DELIM                   
         18,30,                      $ DKD-DESC                 
         C'|',                       $ DELIM                   
         76:48,1,                    $ E-BUD-IND               
         C'|',                       $ DELIM                   
         84:49,1,                    $ VDI-IND                 
         C'|',                       $ DELIM                   
         50,6,PD,EDIT=(TTTTTTT.TTT), $ KESK-AVT-AMNT           
         100:56,1)),                                           
  IFTHEN=(WHEN=(100,1,CH,EQ,C'1'),OVERLAY=(86:C'0000000.000')) 
//*                                                             
//T2F2CNTL DD *                                                 
  INREC BUILD=(5,4,59,6)                                       
  SUM FIELDS=NONE                                               
//*



The output from this job is

Code:

  KKX-IND |  KKX-NUMBER   |  DKD   |           DKD-DESC           |E-BUD-IND|VDI-IND|KESK-AVT-AMNT
      2149|              0|87963278|VINTG LACE X-                 |        Y|       |0000018.100
      1166|   809709671623|89947260|SS FLUTTER SLEEVE TOP         |        N|      N|0000018.100
      1357|   400903494379|90349437|FAS-PNT 2PKT SLUB-GRAY        |        Y|      N|0000000.000
       345|   400931369625|93136962|+PLT EMMA GLTR ITY            |        Y|      N|0000017.100
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Feb 01, 2013 5:28 am
Reply with quote

I Just realized that your FILE3 key in your description mentions it starts at position 1. But your sample data in first post shows at position 5.

I took it from the sample data position. In case your File3 Key actually starts in position 1 , then it is a minor change.

Change the INREC in T2F2CNTL from

//T2F2CNTL DD *
INREC BUILD=(5,4,59,6)

to

//T2F2CNTL DD *
INREC BUILD=(1,4,59,6)


that is the only change you would need.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Feb 01, 2013 6:00 am
Reply with quote

frozenblood,

You have made so many mistakes with seeking this solution, I don't really know where to begin.

Take note, this, and other forums, are not here for when you make a mess of your planning. The purpose is not to do your work for you. If you don't like being told that, you don't have to post questions in the future.

If you repeat these mistakes, including sending PMs or e-mails, multiple posting, failing to Code and Preview your postings, contesting when the errors of your ways are pointed out to you, etc, etc, you may receive a Warning.

Needless to say, if you fail to thank Kolusu for such impressive work, that will not go down so well with us either.
Back to top
View user's profile Send private message
frozenblood
Warnings : 1

New User


Joined: 16 Oct 2012
Posts: 37
Location: INDIA

PostPosted: Fri Feb 01, 2013 12:25 pm
Reply with quote

Thanks a lot for your help kolusu.

Just realised that we use SYNCSORT here and not DFSORT so is there any alternative for JKFROM in syncsort as it doesnt support it?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Feb 01, 2013 12:42 pm
Reply with quote

You claim urgency,
you make A DFSORT developer spend time on Your problem
and at the end You discover that You are using SYNCSORT...
pretty inconsiderate way of acting
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Feb 01, 2013 10:50 pm
Reply with quote

frozenblood wrote:
Thanks a lot for your help kolusu.

Just realised that we use SYNCSORT here and not DFSORT so is there any alternative for JKFROM in syncsort as it doesnt support it?


Well after all the effort I put in to help, you just gave me a perfect start for my Friday. icon_sad.gif

I guess you haven't really paid attention to my signature. I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.
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 TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts How to create a list of SAR jobs with... CA Products 3
No new posts Shift left VB record without x00 endi... DFSORT/ICETOOL 11
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top