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

Need help in SORT


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
pshongal

New User


Joined: 14 Jun 2012
Posts: 96
Location: India

PostPosted: Fri Jun 29, 2012 10:47 am
Reply with quote

I have 3 file with count details as below.

File1- A1:100
File2- A2:110
File3- A3:002

Please help me to get output in File4 as 100110002 using sort or some other utility. This is a reporting requirement.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri Jun 29, 2012 12:09 pm
Reply with quote

Why not use Symnames
Back to top
View user's profile Send private message
pshongal

New User


Joined: 14 Jun 2012
Posts: 96
Location: India

PostPosted: Fri Jun 29, 2012 12:25 pm
Reply with quote

Never used it. Let me check how I can use it. Thank you.
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 Jun 29, 2012 12:36 pm
Reply with quote

Or RESIZE - but I do not know if SYNSORT has RSIZE
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1691
Location: Tiruppur, India

PostPosted: Fri Jun 29, 2012 12:42 pm
Reply with quote

Hi,
Since you are new to the forum there is a possibility of mixing up sort products.
Can you let us know what sort product you have?
Run the code below and post the JES SYSOUT element so that we can see the sort product and release level that you have installed.

Code:
//SORTSTEP EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
ABC
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  SORT     FIELDS=COPY
Back to top
View user's profile Send private message
pshongal

New User


Joined: 14 Jun 2012
Posts: 96
Location: India

PostPosted: Fri Jun 29, 2012 2:20 pm
Reply with quote

Hi Vasanthz,
I ran it. This is the product info

"SYNCSORT FOR Z/OS 1.3.2.1R U.S. PATENTS: 4210961, 5117495 (C) 2007 SYNCSORT INC."
Back to top
View user's profile Send private message
pshongal

New User


Joined: 14 Jun 2012
Posts: 96
Location: India

PostPosted: Fri Jun 29, 2012 2:47 pm
Reply with quote

Nic,

SyncSort does't have RESIZE. IceTool has it. Anything equvivalent to that is available in SyncSort?
Back to top
View user's profile Send private message
Naish

New User


Joined: 07 Dec 2006
Posts: 82
Location: UK

PostPosted: Fri Jun 29, 2012 2:49 pm
Reply with quote

Hello Nic,

TS has three different files with the count in each file. AFAIK RESIZE will work if there are only three records in one single file of the type:

Code:
100
110
002

Sort card:
Code:
//TOOLIN DD *
RESIZE FROM(IN1) TO(OUT1) TOLEN(9)


Also, I am not sure whether RESIZE works on Syncsort.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1691
Location: Tiruppur, India

PostPosted: Fri Jun 29, 2012 2:57 pm
Reply with quote

Hello,
Try this,
assuming LRECL 80 FB and file1,file2,file 3 have same dataset attributes.
Code:
//WELLS   EXEC PGM=SYNCTOOL                                   
//TOOLMSG DD SYSOUT=*                                         
//DFSMSG  DD SYSOUT=*                                         
//IN      DD DSN=FILE1,DISP=SHR
//        DD DSN=FILE2,DISP=SHR
//        DD DSN=FILE3,DISP=SHR                                                                                                     
//OUT     DD DSN=FILE4,DISP=OLD                                         
//TOOLIN DD *                                                 
 SPLICE FROM(IN) TO(OUT) ON(81,8,ZD) WITHEACH -               
 WITH(4,3) WITH(7,3) USING(CTL1)                             
/*                                                           
//CTL1CNTL DD *                                               
 OPTION COPY                                                 
 INREC IFTHEN=(WHEN=GROUP,RECORDS=3,PUSH=(81:ID=8,89:SEQ=2)),
 IFTHEN=(WHEN=(89,2,ZD,EQ,1),OVERLAY=(1:4,3)),               
 IFTHEN=(WHEN=(89,2,ZD,EQ,2),OVERLAY=(4:4,3)),               
 IFTHEN=(WHEN=(89,2,ZD,EQ,3),OVERLAY=(7:4,3))                 
 OUTFIL FNAMES=OUT,BUILD=(1,80)
/*                   


Hope it helps.
Back to top
View user's profile Send private message
bodatrinadh

Active User


Joined: 05 Jan 2007
Posts: 101
Location: chennai (India)

PostPosted: Fri Jun 29, 2012 3:24 pm
Reply with quote

Hello pshongal,

Here is one more solution..

Code:

//STEP1    EXEC PGM=SORT                                         
//SYSPRINT DD SYSOUT=*                                           
//SYSOUT DD SYSOUT=*                                             
//SORTOUT DD SYSOUT=*                                             
//SORTIN   DD *                                                   
A1:100                                                           
A2:110                                                           
A3:002                                                           
//SYSIN    DD *                                                   
 INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'A',82:SEQNUM,4,ZD)),       
   IFTHEN=(WHEN=(82,4,ZD,EQ,1),OVERLAY=(7:C'000000')),           
   IFTHEN=(WHEN=(82,4,ZD,EQ,2),                                   
                 BUILD=(1,3,4:C'000',7:4,3,10:C'000',81:1,1)),   
   IFTHEN=(WHEN=(82,4,ZD,EQ,3),                                   
                 BUILD=(1,3,4:C'000000',10:4,3,81:1,1))           
  SORT FIELDS=(81,1,CH,A)                                         
  SUM FIELDS=(4,3,ZD,7,3,ZD,10,3,ZD)                             
  OUTREC FIELDS=(4,10,70X)                                       


Your Output:-
Code:

100110002


Thanks
-3nadh
Back to top
View user's profile Send private message
pshongal

New User


Joined: 14 Jun 2012
Posts: 96
Location: India

PostPosted: Fri Jun 29, 2012 4:14 pm
Reply with quote

Hi bodatrinadh,

That's fentastic. It does work.

I did not get why IFTHEN=(WHEN=(82,4,ZD,EQ,1),OVERLAY=(7:C'000000')) is being done? Could u please explain?
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Jun 29, 2012 5:08 pm
Reply with quote

Or even this.
Code:
//SYSIN    DD  *                                             
 INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,1,ZD)),           
       IFTHEN=(WHEN=GROUP,BEGIN=(81,1,ZD,EQ,1),PUSH=(82:4,3)),
       IFTHEN=(WHEN=GROUP,BEGIN=(81,1,ZD,EQ,2),PUSH=(85:4,3))
 SORT FIELDS=COPY                                             
 OUTFIL INCLUDE=(81,1,ZD,EQ,3),BUILD=(82,3,85,3,4,3)         
/*                                                           
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 Jun 29, 2012 6:13 pm
Reply with quote

I think DFSORT RESIZE would work. With DFSORT. By concatenating the three single-record files, they are "one file" with three records. They can be "normalised" with BUILD in a CNTL file for the RESIZE.

Otherwise, like Arun, I'd go for the GROUP. I'd check for the record types rather than the actual sequence. I'd also want to know what the input would look like with no records on the relevant original file.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Jun 29, 2012 7:12 pm
Reply with quote

Hello,

Unfortunately, Syncsort has not incorporated RESIZE (yet?).
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10833
Location: italy

PostPosted: Fri Jun 29, 2012 7:38 pm
Reply with quote

Quote:
Need help in SORT

why not use a more intelligent title icon_question.gif icon_evil.gif
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts WER999A - UNSUCCESSFUL SORT 8ED U Ab... SYNCSORT 5
No new posts COBOL Ascending and descending sort n... COBOL Programming 5
No new posts SORT deletes the SORTOUT file DFSORT/ICETOOL 8
No new posts Creating CSV file from Variable recs ... DFSORT/ICETOOL 11
No new posts Need suggestion on a sort card DFSORT/ICETOOL 10
Search our Forums:

Back to Top