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 in SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
pshongal

New User


Joined: 14 Jun 2012
Posts: 70
Location: India

PostPosted: Fri Jun 29, 2012 10:47 am    Post subject: Need help in SORT
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

Moderator


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

PostPosted: Fri Jun 29, 2012 12:09 pm    Post subject:
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: 70
Location: India

PostPosted: Fri Jun 29, 2012 12:25 pm    Post subject:
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: 1712
Location: UK

PostPosted: Fri Jun 29, 2012 12:36 pm    Post subject:
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: 1445
Location: Azeroth

PostPosted: Fri Jun 29, 2012 12:42 pm    Post subject:
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: 70
Location: India

PostPosted: Fri Jun 29, 2012 2:20 pm    Post subject:
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: 70
Location: India

PostPosted: Fri Jun 29, 2012 2:47 pm    Post subject:
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    Post subject:
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: 1445
Location: Azeroth

PostPosted: Fri Jun 29, 2012 2:57 pm    Post subject:
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    Post subject: Reply to: Need help in SORT
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: 70
Location: India

PostPosted: Fri Jun 29, 2012 4:14 pm    Post subject:
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: 2158
Location: @my desk

PostPosted: Fri Jun 29, 2012 5:08 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Jun 29, 2012 6:13 pm    Post subject: Reply to: Need help in SORT
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

Site Director


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

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

Hello,

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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Fri Jun 29, 2012 7:38 pm    Post subject: Reply to: Need help in SORT
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM 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