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
 

 

Need help with SORT

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

New User


Joined: 26 Feb 2007
Posts: 34
Location: pune

PostPosted: Mon Jul 04, 2011 4:30 pm    Post subject: Need help with SORT
Reply with quote

I need help to convert my program to a sort.

Requirment is as below

File 1 : LREC 30

Where 1-8 key value, 9-10 - data

9999999911
8888888822
7777777733

File 2 : LREC 344

where 37-44 key value
XXXXX...99999999......
XXXXX...44444444......
XXXXX...22222222......

Output : LREC 346

If match found then use the data from file 1 else fill zero in 345-346

XXXXX...99999999......11
XXXXX...44444444......00
XXXXX...22222222......00

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

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Mon Jul 04, 2011 4:36 pm    Post subject:
Reply with quote

Are you sure that you are using DFSORT, and if so which release level are you. Please run a dummy sort step and post the SYSOUT segment.
Back to top
View user's profile Send private message
Dsingh29

Active User


Joined: 16 Dec 2008
Posts: 132
Location: IBM

PostPosted: Mon Jul 04, 2011 4:38 pm    Post subject: Reply to: Need help on JCL sort
Reply with quote

did you searched forum for the solution? icon_idea.gif
Back to top
View user's profile Send private message
purushottam

New User


Joined: 26 Feb 2007
Posts: 34
Location: pune

PostPosted: Mon Jul 04, 2011 5:17 pm    Post subject: Reply to: Need help on JCL sort
Reply with quote

Version 1 and release 10

Code:
ICE143I 0 BLOCKSET     COPY  TECHNIQUE SELECTED                                 
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R10 - 13:33 ON MON JU
            OPTION COPY   
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Jul 04, 2011 5:37 pm    Post subject:
Reply with quote

having nothing better to do than read these threads that go on and on,
because the TS has no idea what he is doing,
and, unfortunately, we do not ask complete, detailed questions,
(as one would of an infant):

this link is a sticky in the dfsort forum: How to determine your DFSORT function level

the following is an excerpt from the above thread, that is easy to find,
when one scrolls thru the dfsort forum list looking for a similar topic:
Quote:
To determine which level of DFSORT functions you have available, look at message ICE201I in the //SYSOUT messages you receive from the DFSORT job shown below, or from any successful DFSORT job.

If you see:

ICE201I H RECORD TYPE ...

the H indicates you have the October, 2010 DFSORT functions (RESIZE, IFTRAIL, ACCEPT, ADDDAYS, DATEDIFF, TRAN=ATOE, KEYBEGIN, etc) and all of the earlier functions. This function level corresponds to z/OS DFSORT V1R10 PTF UK90025 and z/OS DFSORT V1R12 PTF UK90026. You are completely up to date on DFSORT functional PTFs.

Note: If you see WERxxxs messages, you have Syncsort, not DFSORT.

If you see:

ICE201I G RECORD TYPE ...

the G indicates you have the November, 2009 DFSORT functions (JOINKEYS, TOJUL, TOGREG, WEEKDAY, etc) and all of the earlier functions. This function level corresponds to z/OS DFSORT V1R5 PTF UK51706 and z/OS DFSORT V1R10 PTF UK51707. You are behind on DFSORT functional PTFs. Ask your System Programmer to install z/OS DFSORT V1R10 PTF UK90025 or z/OS DFSORT V1R12 PTF UK90026.

If you see:

ICE201I F RECORD TYPE ...

the F indicates you have the July, 2008 DFSORT functions (FINDREP, WHEN=GROUP, DATASORT, SUBSET, etc) and all of the earlier functions.
This function level corresponds to z/OS DFSORT V1R5 PTF UK90013 and z/OS DFSORT V1R10 PTF UK90014. You are behind on DFSORT functional PTFs. Ask your System Programmer to install z/OS DFSORT V1R10 PTF UK90025 or z/OS DFSORT V1R12 PTF UK90026.

If you see:

ICE201I E RECORD TYPE ...

the E indicates you have the April, 2006 DFSORT functions (PARSE, JFY, SQZ, SPLIT1R, etc) and all of the earlier functions. This function level corresponds to z/OS DFSORT V1R5 PTF UK90007. You are behind on DFSORT functional PTFs. Ask your System Programmer to install z/OS DFSORT V1R10 PTF UK90025 or z/OS DFSORT V1R12 PTF UK90026.

If you see:

ICE201I 0 RECORD TYPE ...

the 0 indicates you do not have the July, 2008 or April, 2006 DFSORT functions. You are way behind on DFSORT functional PTFs. Ask your System Programmer to install z/OS DFSORT V1R10 PTF UK90025 or z/OS DFSORT V1R12 PTF UK90026.

You may or may not have the Dec, 2004 DFSORT functions (IFTHEN, OVERLAY, SFF, UFF, etc), which corresponds to z/OS DFSORT V1R5 PTF UQ95214. try using one of these functions - if you get errors trying to use it, then you don't even have the Dec, 2004 PTF installed.


5 posts, and we still do not know at what level of dfsort to offer a solution.
Back to top
View user's profile Send private message
purushottam

New User


Joined: 26 Feb 2007
Posts: 34
Location: pune

PostPosted: Mon Jul 04, 2011 6:05 pm    Post subject: Reply to: Need help with SORT
Reply with quote

Oops icon_idea.gif ..I will remeber this

Code:
ICE201I H RECORD TYPE IS F - DATA STARTS IN POSITION 1


It means i have October, 2010 DFSORT function
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Jul 04, 2011 6:54 pm    Post subject:
Reply with quote

purushottam,

good post, that means you don't have JOINKEYS, which would have been something easy, that even I could provide as a solution.

don't know if the ICETOOL Splice is available to you,
but you could try implementing this example: 3.1.16 Joining Fields from Different Data Sets in the dfsort getting started manual.

good luck.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Jul 04, 2011 8:12 pm    Post subject:
Reply with quote

Code:

//STEP0100 EXEC PGM=ICETOOL
//SYSOUT   DD SYSOUT=*
//SORTMSG  DD SYSOUT=*
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//SORTIN1  DD DSN=30-char-file,DISP=SHR
//SORTIN2  DD DSN=344-char-file,DISP=SHR
//T1       DD  DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(75,50)),
//             DISP=(MOD,PASS)
//SORTOUT  DD  DSN=346-perfectly-spliced-file,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,SPACE=(TRK,(1500,100),RLSE),
//             DCB=(RECFM=FB,BLKSIZE=0)
//OUTHOLD  DD  DSN=temp-file-so-that-I-could-debug,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,SPACE=(TRK,(1500,100),RLSE),
//             DCB=(RECFM=FB,BLKSIZE=0)
//SYSIN    DD *
//TOOLIN   DD *
*  CREATE 346 BYTE FILE FROM FILE 2
  COPY FROM(SORTIN2) TO(T1) USING(CTL2)
*  CREATE 346 BYTE FILE FROM FILE 1
  COPY FROM(SORTIN1) TO(T1) USING(CTL1)
*  SAVE TEMP FILE
  COPY FROM(T1) TO(OUTHOLD) USING(CTL3)
*  SPLICE IT
  SPLICE FROM(T1) TO(SORTOUT) ON(37,8,CH) WITH(345,2) WITHALL KEEPNODUPS
//*
//CTL1CNTL DD *
 OPTION COPY
 OUTREC BUILD=(37:1,10,
               48:296X,
              345:9,2)
/*
//CTL2CNTL DD *
 OPTION COPY
 OUTREC BUILD=(01:1,44,
               46:299X,
              345:C'00')
/*
//CTL3CNTL DD *
 OPTION COPY
/*


outhold dd statement can be removed
also, ctl2cntl
and
* SAVE TEMP FILE
COPY FROM(T1) TO(OUTHOLD) USING(CTL3)
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Jul 04, 2011 9:18 pm    Post subject:
Reply with quote

well i spent 1/2 hour coming up with the SPLICE which has a logic flaw,
which occurred to me on the ride home.

now, bill has pointed me in the correct direction,
since the ts has H,
that means he is relatively up-to-date
and can use the JOINKEYS application solution.

I am home (ts is probably, also), so no more tonight
except to say,
1. KEEPNODUPS may or may not keeps non-matches from file 2
(too lazy to look-it-up in the manual.

if KEEPNODUPS keeps the non-matches from file 2, then they can be found, based on what is missing from file 1.

If KEEPNODUPS does not keep the non-matches from file 2,
then you need to do something else with SPLICE,
though the far-superior JOINKEYS has a parm which will identify (actually send them to another output file)
so that they can be reported.
Back to top
View user's profile Send private message
purushottam

New User


Joined: 26 Feb 2007
Posts: 34
Location: pune

PostPosted: Mon Jul 04, 2011 10:06 pm    Post subject: Reply to: Need help with SORT
Reply with quote

Yes dbzTHEdinosauer JOINKEY's is quite easy to understand to me compared to SPLICE. I tried below SORT and it seems to be working

Code:
//SYSIN    DD  *                         
  JOINKEYS F1=INA,FIELDS=(1,5,A)         
  JOINKEYS F2=INB,FIELDS=(1,5,A)         
  JOIN UNPAIRED,F1                       
  REFORMAT FIELDS=(F1:1,5,F2:1,6)       
  SORT FIELDS=COPY                       
  OUTREC IFTHEN=(WHEN=(11,1,CH,EQ,C' '),
          BUILD=(1,5,C'0')),             
          IFTHEN=(WHEN=NONE,             
                  BUILD=(1,5,11,1))     
 SORT FIELDS=COPY                       
//*     



PS: File layout and key positions are different as I tried in test data set.

Thanks much for your valuable time !
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Tue Jul 05, 2011 5:43 am    Post subject: Reply to: Need help with SORT
Reply with quote

Puru,

Good crack at it, and good idea to work it out with a simple test file first.

I think you have one too many SORT FIELDS=COPYs. Have a look at some of the other examples in the forum. The order of statements mostly doesn't matter to SORT (you can check exactly in the manual), but people tend to do them in about the same way.

You can be a bit more positive about ICETOOL. It is a powerful tool/utility/language, with many more posibilities than a plain SORT (which is very flexible anyway). If you are unfamiliar with it, like anything else new you come across, it looks complicated. Look at some examples in the documentation. Try to do some little things in it, become more familiar, and there you go.

When you get to something complicated, have a go at it, if you get stuck, you can always come back here for clarifications or assistance.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Tue Jul 05, 2011 8:12 pm    Post subject:
Reply with quote

purushottam,
Alternatively you can also write something as shown below. For any unpaired F1 records, this initializes F2 fields with c'0'.
Code:
//SYSIN    DD  *                         
  JOINKEYS F1=INA,FIELDS=(1,5,A)         
  JOINKEYS F2=INB,FIELDS=(1,5,A)         
  JOIN UNPAIRED,F1                       
  REFORMAT FIELDS=(F1:1,5,F2:6,1),FILL=C'0'       
  SORT FIELDS=COPY                       
//*

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 Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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