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
 

 

Sort File using ICETOOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Mithun MF

New User


Joined: 09 Sep 2010
Posts: 7
Location: Chennai

PostPosted: Mon Sep 27, 2010 4:50 pm    Post subject: Sort File using ICETOOL
Reply with quote

Hi all,
I have the requirement that has to merge the files F1 and F2
based on the keys ( In F1 -> 10th byte to 22nd Byte , F2 -> 1st - 13th byte) if this key match replace the value from F2 (14,3) into F1(343,3).
If key dosent match (Unpaired records in F1) dont skip write it in the sorted out file.
Where F1 is VB , F2 - LRecl 16.
Please help me on this.
Thanks,
Mithun
Back to top
View user's profile Send private message

prahalad

New User


Joined: 14 Sep 2010
Posts: 18
Location: Pune

PostPosted: Mon Sep 27, 2010 6:39 pm    Post subject:
Reply with quote

Hi Mithun,

Can you please provide me some more information.

1) For unpaired records in F1 what will be the values in F1(343,3)?
do you want SPACES or values as it is in F1 for position F1(343,3)?

2) Is The output file format will be as like F1.

3) Instead of using ICETOOL, whether SORTJOIN(joinkeys) will work for you?
Back to top
View user's profile Send private message
Mithun MF

New User


Joined: 09 Sep 2010
Posts: 7
Location: Chennai

PostPosted: Mon Sep 27, 2010 6:57 pm    Post subject:
Reply with quote

Hi Prahald,

@ 1 -> What ever the record present in file(F1) will be written for unpaired. Data Type is PIC S9(3)V9 COMP-3.

@ 2 -> Yes the format should be same as F1

@ 3 -> YEs Join keys thru sort will work for me.

Thanks,
Mithun
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Mon Sep 27, 2010 7:38 pm    Post subject:
Reply with quote

Mithun MF,
Could you have duplicates in any of the files (File1 and/or File2)? Please show sample input data and expected output with all possible combinations (i.e. dups in file1 and/or file2).
Quote:
If key dosent match (Unpaired records in F1) dont skip write it in the sorted out file.
Do you want all the fields or just key(10th byte to 22nd Byte) in your output file? Please show that in your sample data.

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

New User


Joined: 14 Sep 2010
Posts: 18
Location: Pune

PostPosted: Mon Sep 27, 2010 7:49 pm    Post subject:
Reply with quote

Mithun,

Assuming the F1 file has LRECL = 500. As it is a VB file so LRECL = 500+ 4 = 504.
As F1 is VB in the below code we use keys starting pos as 14 (10 + 4)
JOINKEYS FILES=F1,FIELDS=(14,13,A)
You can use the following SORT:

Code:

//SORTOUT   DD DSN=dataset name,                           
//             DISP=(NEW,CATLG),                                       
//             DCB=(RECFM=VB,LRECL=504),                               
//             SPACE=(CYL,(500,500),RLSE),UNIT=TSTDA                   
//SYSIN     DD *                                                       
 JOINKEYS FILES=F1,FIELDS=(14,13,A)                                   
 JOINKEYS FILES=F2,FIELDS=(1,13,A)                                     
 JOIN UNPAIRED,F1                                                     
 REFORMAT FIELDS=(F1:5,500,F2:14,3)                                   
 SORT FIELDS=COPY                                                     
 OUTFIL IFTHEN=(WHEN=(501,3,CH,EQ,C'   '),BUILD=(1,500)),             
        IFTHEN=(WHEN=(501,3,CH,NE,C'   '),BUILD=(1,342,501,3,346,155)),
        FTOV
Back to top
View user's profile Send private message
Mithun MF

New User


Joined: 09 Sep 2010
Posts: 7
Location: Chennai

PostPosted: Mon Sep 27, 2010 8:00 pm    Post subject:
Reply with quote

Hi All,
Here is my sample input file and expected output file

F1

----+----1----+----2----+--------------------------------343-----------------
**********************************************************
439523216002010003055106472............................................
439523216002010003055605561...................007...................
439523216002010003055606472...................007...................
439523216002010003055906472...........................................

F2

----+----1----+----2-
*********************
0020100030551005
0020100030553006
0020100030556009

Expected O/P

----+----1----+----2----+--------------------------------343-----------------
**********************************************************
439523216002010003055106472............................................
439523216002010003055605561.................009.................
439523216002010003055606472.................009.................
439523216002010003055906472........................................


Now can anyone help me on this
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Mon Sep 27, 2010 8:15 pm    Post subject:
Reply with quote

Mithun MF,
If I am not mistaken, your input and output doesn't seem to match per requirements. Your F1 shows a record for key (0020100030551) and F2 has a record with the same key and a value of 005. Now, in your expected output you don't show 005 overlaid on position 343 for 3 bytes. But again for the key 0020100030556, in your expected output you show that value of 009 from F2 overlays 007 from F1.

Is that a typo or do you just want to overlay records in File1 if it already has some value in it?
Quote:
Now can anyone help me on this
Please don't get frustrated with questions but everyone here tries to get clear picture of the requirements and refrain from making assumptions only to find out it doesn't suit your need(s).

Thanks,
Back to top
View user's profile Send private message
Mithun MF

New User


Joined: 09 Sep 2010
Posts: 7
Location: Chennai

PostPosted: Mon Sep 27, 2010 8:35 pm    Post subject:
Reply with quote

Hi Sqlcode1,

I Could explain it clearly now

F1

----+----1----+----2----+--------------------------------343-----------------
**********************************************************
439523216002010003055106472............................................ ( 10th byte to 22nd Byte)
439523216002010003055605561...................007................... ( 10th byte to 22nd Byte)
439523216002010003055606472...................007................... ( 10th byte to 22nd Byte)
439523216002010003055906472........................................... ( 10th byte to 22nd Byte)

F2

----+----1----+----2-
*********************
0020100030550005 (1-13 Byte)
0020100030553006 (1-13 Byte)
0020100030556009 (1-13 Byte)

Expected O/P

----+----1----+----2----+--------------------------------343-----------------
**********************************************************
439523216002010003055106472............................................ (Not paired with F1/F2 , Write the record as in F1 )
439523216002010003055605561.................009.................
(Paired with F1 and F2 replace 343,3 in F1 with 14,3 in F2 { replaced 007 with 009} )
439523216002010003055606472.................009.................
(Paired with F1 and F2 replace 343,3 in F1 with 14,3 in F2 { replaced 007 with 009} )
439523216002010003055906472........................................
(Not paired with F1/F2 , Write the record as in F1 )

Hope this gives better understanding.
Thanks,Mithun
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Mon Sep 27, 2010 9:53 pm    Post subject:
Reply with quote

Mithun MF,
See if below jcl works for you.

Since your input F1 is VB, I am assuming that the key starts at 14th position, if it indeed starts 10th position, change the joinkeys statement accordingly.
Code:
//STEP01   EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTJNF1 DD DISP=SHR,DSN=INPUT F1, VB-500                             
//SORTJNF2 DD DISP=SHR,DSN=INPUT F2, FB-016                             
//SORTOUT  DD  OUTPUT                                                   
//SYSIN    DD *                                                         
  JOINKEYS FILE=F1,FIELDS=(14,13,A)                                     
  JOINKEYS FILE=F2,FIELDS=(01,13,A)                                     
  JOIN UNPAIRED,F1                                                     
  REFORMAT FIELDS=(F1:1,4,?,F2:14,3,F1:5)                               
  SORT FIELDS=COPY                                                     
  INREC IFTHEN=(WHEN=(5,1,CH,EQ,C'B'),OVERLAY=(348:6,3))               
  OUTREC BUILD=(1,4,9)                                                 
/*                                                                     


Thanks,
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 How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 11 Tue May 16, 2017 2:20 pm
No new posts Using ICETOOL, how we can seperate th... bshkris SYNCSORT 5 Tue May 09, 2017 8:33 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm


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