View previous topic :: View next topic
|
Author |
Message |
thala_ds
New User
Joined: 05 Jun 2012 Posts: 18 Location: India
|
|
|
|
Hi,
I have a requirement to sort the input with LRECL = 2882 Format = FB.
I have to sort the field (72,2,BI,A) and then i have to copy only the last record in one file and the rest of all the records in another file. Can someone advise on how to proceed.
I can use SUBSET if i need to extract only the last record. But i need rest of the records in another file.
Thanks,
thala_ds. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Do we have an identifier to find the last record after sort? |
|
Back to top |
|
|
thala_ds
New User
Joined: 05 Jun 2012 Posts: 18 Location: India
|
|
|
|
Hi,
After sorting, that field will have the maximum value(in position we sorted -->72,2). I have to extract only that maximum value record in one file and rest of the record in another file. We don't have any other identifier.
Thanks. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
I suggest you get back to the manual, read up on SUBSET, experiment, then implement it. Pay attention to USING.
Please don't give answers like this to perfectly reasonable questions:
Quote: |
After sorting, that field will have the maximum value(in position we sorted -->72,2) |
|
|
Back to top |
|
|
thala_ds
New User
Joined: 05 Jun 2012 Posts: 18 Location: India
|
|
|
|
Bill,
Thanks.. I was able to get the required output using the below ICETOOL as you suggested.
SUBSET FROM(IN1) TO(OUT1) DISCARD(OUT2) KEEP INPUT LAST(1)
Thanks a lot. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Well done, but I don't see a SORT anywhere. You're not SORTing first then using SUBSET are you?
Code: |
what you have plus USING(xxxx)
xxxxCNTL
SORT FIELDS=(72,2,BI,A) |
Then you only have one pass of the file. Pay attention to the documentation if you feel it doesn't "work". |
|
Back to top |
|
|
thala_ds
New User
Joined: 05 Jun 2012 Posts: 18 Location: India
|
|
|
|
Bill,
Yes. i have to sort before using subset. Please see my sort card below.
//TOOLIN DD *
SUBSET FROM(IN1) TO(OUT1) DISCARD(OUT2) KEEP INPUT LAST(1) -
USING(CTL1)
//CTL1CNTL DD *
SORT FIELDS=(72,2,BI,A)
/*
The above statement is failing with RC=16. But if i use SORT FIELDS=COPY, its running fine. Can you please help me on that?.
Thanks. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Can you show the sysout of the failure please? |
|
Back to top |
|
|
thala_ds
New User
Joined: 05 Jun 2012 Posts: 18 Location: India
|
|
|
|
Bill,
Here is the SYSOUT of the failing job.
Code: |
SYNCSORT FOR Z/OS 1.3.2.1RI U.S. PATENTS: 4210961, 5117495 (C) 2007 SYNCSO
z/OS 1.12.0
SYNCSORT LICENSED FOR CPU SERIAL NUMBER 40BE0, MODEL 2817 752 LICEN
CTL1CNTL :
SORT FIELDS=(72,2,BI,A)
PARMLIST :
OPTION RESINV=0,ARESINV=0,MSGDDN=DFSMSG,SORTIN=IN1,SORTDD=CTL1,SORTOUT=OUT1,DYNA
LLOC,CMP=CLC,NOVLSHRT,EQUALS
SORT FIELDS=COPY
MODS E15=(SYNC##15,4096,,N)
OUTFIL FNAMES=OUT1
OUTFIL FNAMES=OUT2
WER428I CALLER-PROVIDED IDENTIFIER IS "0001"
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE |
Code'd |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
You posted on the DFSORT section of the Forum
and people wasted time trying to diagnose a problem for the wrong environment
topic moved where it belongs |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Is that all the sysout?
You have a fairly old SyncSort. Maybe do the two-step for now, and I'll try to dig up a different solution when I have more time. |
|
Back to top |
|
|
thala_ds
New User
Joined: 05 Jun 2012 Posts: 18 Location: India
|
|
|
|
Bill,
I slightly modified the same sort card and got the expected output.
Code: |
//TOOLIN DD *
SUBSET FROM(IN1) TO(OUT1) DISCARD(OUT2) KEEP [color=red]OUTPUT[/color] LAST(1) -
USING(CTL1)
/*
//CTL1CNTL DD *
SORT FIELDS=(72,2,BI,A)
/*
|
Thanks for your help on this.
Code'd again |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Please use the Code tags to preserve spacing.
With DFSORT I got an error message for INPUT. Without an error message from SyncSort I thought maybe not worth telling you to change to OUTPUT. INPUT is the wrong place anyway, as it would be the last record of the unsorted file.
Thanks for letting us know. |
|
Back to top |
|
|
|