View previous topic :: View next topic
Author
Message
pshongal New User Joined: 14 Jun 2012Posts: 98 Location: India
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
Pandora-Box Global Moderator Joined: 07 Sep 2006Posts: 1592 Location: Andromeda Galaxy
Why not use Symnames
Back to top
pshongal New User Joined: 14 Jun 2012Posts: 98 Location: India
Never used it. Let me check how I can use it. Thank you.
Back to top
Nic Clouston Global Moderator Joined: 10 May 2007Posts: 2454 Location: Hampshire, UK
Or RESIZE - but I do not know if SYNSORT has RSIZE
Back to top
vasanthz Global Moderator Joined: 28 Aug 2007Posts: 1744 Location: Tirupur, India
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
pshongal New User Joined: 14 Jun 2012Posts: 98 Location: India
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
pshongal New User Joined: 14 Jun 2012Posts: 98 Location: India
Nic,
SyncSort does't have RESIZE. IceTool has it. Anything equvivalent to that is available in SyncSort?
Back to top
Naish New User Joined: 07 Dec 2006Posts: 82 Location: UK
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:
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
vasanthz Global Moderator Joined: 28 Aug 2007Posts: 1744 Location: Tirupur, India
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
bodatrinadh Active User Joined: 05 Jan 2007Posts: 101 Location: chennai (India)
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:-
Thanks
-3nadh
Back to top
pshongal New User Joined: 14 Jun 2012Posts: 98 Location: India
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
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
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
Bill Woodger Moderator Emeritus Joined: 09 Mar 2011Posts: 7309 Location: Inside the Matrix
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
dick scherrer Moderator Emeritus Joined: 23 Nov 2006Posts: 19243 Location: Inside the Matrix
Hello,
Unfortunately, Syncsort has not incorporated RESIZE (yet?).
Back to top
enrico-sorichetti Superior Member Joined: 14 Mar 2007Posts: 10888 Location: italy
why not use a more intelligent title
Back to top
Please enable JavaScript!