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

SUM file with secondary sorted file


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
cdelaf32

New User


Joined: 22 Apr 2016
Posts: 4
Location: United States

PostPosted: Mon Apr 25, 2016 10:20 pm
Reply with quote

I am trying to create a summary file and a complete sorted file using a single execution. File 1 is the complete file sorted and file 2 is to be only a summary file utilizing SUM=None.
Here is my attempt, however I am getting an error on the Sum field. I am in a VSE environment.
Code:
// DLBL    SORTIN1,'DP.MA.PY440'               
// DLBL    SORTOUT,'DP.MA.PY440.SRTD'           
// EXTENT  SYS001,LCPROD,,,1,500                       
// DLBL    SORTOF2,'DP.MA.PY440.SUMX'       
// EXTENT  SYS002,LCPROD,,,1,500                       
// EXEC SORT,SIZE=(SORT,700K)                             
 SORT FIELDS=(10,5,CH,A,1,10,CH,A),                       
        FILES=1,WORK=1,FILESOUT=2                         
 RECORD TYPE=F,LENGTH=080                                 
 INPFIL BLKSIZE=800                                       
 OUTFIL FILES=1,DISK,                                     
 SUM FIELDS=NONE                                         
 OUTFIL FILES=2,DISK


code' d by a moderator
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


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

PostPosted: Mon Apr 25, 2016 10:34 pm
Reply with quote

Do you mind pasting your SYSOUT message as well?
Back to top
View user's profile Send private message
cdelaf32

New User


Joined: 22 Apr 2016
Posts: 4
Location: United States

PostPosted: Mon Apr 25, 2016 10:37 pm
Reply with quote

Code:
SORT FIELDS=(10,5,CH,A,1,10,CH,A)                                     
        FILES=1,WORK=1,FILESOUT=2                                     
        *                                                             
 RECORD TYPE=F,LENGTH=80                                               
 INPFIL BLKSIZE=800                                                   
 OUTFIL FILES=1,DISK,                                                 
        INCLUDE=(713,8,CH,LT,C'20111103')                             
 OUTFIL FILES=2,DISK,                                                 
        SUM FIELDS=NONE                                               
        *                                                             
                                                                       
   WER100A  INVALID STATEMENT BEFORE END STMT                         
   WER047A  OUTFIL STATEMENT HAS SYNTAX ERROR                         
   WER234A  DIAG= 08000004 00000000 00000000 00000000 00070000 00000000
   WER400A  CRITICAL ERROR, SORT TERMINATED                           
   WER117A  PHASE 0 HAS CRITICAL ERROR


code' d again
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Mon Apr 25, 2016 10:48 pm
Reply with quote

the code tags force a fixed pitch font making easier to read sources/jcl/data

with the code tags
Code:
"          1234567890"


without

" 1234567890"
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


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

PostPosted: Mon Apr 25, 2016 10:57 pm
Reply with quote

What you are trying to do is not correct, You would need a two step/Pass solution to achieve this
Back to top
View user's profile Send private message
cdelaf32

New User


Joined: 22 Apr 2016
Posts: 4
Location: United States

PostPosted: Mon Apr 25, 2016 11:01 pm
Reply with quote

I made slight variation and the execution works however I did not get expected results. here is sample data:
Code:
200090104    78778
200090110    78778
200130101    78778
200130101    78778

I would expect to get on file 1 4 records and file 2 3 records.

Code:
// DLBL    SORTIN1,'DP.MA.PY440'           
// DLBL    SORTOUT,'DP.MA.PY440.SRTD'     
// EXTENT  SYS001,LCPROD,,,1,500                 
// DLBL    SORTOF2,'DP.MA.PY440.SUMX',15   
// EXTENT  SYS002,LCPROD,,,1,500                 
// EXEC SORT,SIZE=(SORT,700K)                     
 SORT FIELDS=(10,5,CH,A,1,10,CH,A),               
      FILESOUT=2                                 
 RECORD TYPE=F,LENGTH=080                         
 INPFIL BLKSIZE=800                               
 OUTFIL FILES=1,INCLUDE=ALL,DISK                 
 OUTFIL FILES=2,DISK                             
 SUM FIELDS=NONE                                 
                                                 
   WER029I  **END PHASE 0 NO ERRORS DETECTED**   
   WER221I  B =       819                         
   WER222I  G =    150267                         
   WER228I  INSERT         0, DELETE         1   
   WER227I  RCD IN         4, OUT          3
   WER225I  *** END SORT PHASE ***                             
   WER407I  SORTOUT  :  DATA RECORDS OUT         3             
   WER408I  SORTOUT  : TOTAL RECORDS OUT         3             
   WER407I  SORTOF2  :  DATA RECORDS OUT         3             
   WER408I  SORTOF2  : TOTAL RECORDS OUT         3             
   WER226A  END SYNCSORT (SRTMULTI), RECORD=         3, INCORE 
1S55I  LAST RETURN CODE WAS 0000         
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


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

PostPosted: Mon Apr 25, 2016 11:04 pm
Reply with quote

Try this:

Step 1 : Step 1 sort the file and place to output file 1
Step 2 : Step 2 sort and eliminate the duplicates to output file 2
Back to top
View user's profile Send private message
cdelaf32

New User


Joined: 22 Apr 2016
Posts: 4
Location: United States

PostPosted: Mon Apr 25, 2016 11:11 pm
Reply with quote

I was hoping to achieve this in a single executing if at all possible.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


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

PostPosted: Mon Apr 25, 2016 11:18 pm
Reply with quote

You could still achieve it through SYNCTOOL but it will be a two pass solution
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2011
Location: USA

PostPosted: Thu Aug 11, 2016 3:19 am
Reply with quote

One-step sort with SYNCSORT looks like this

Code:

//SORT02   EXEC PGM=SYNCSORT     
//*                               
//SYSOUT   DD  SYSOUT=*           
//*                               
//FULLSORT DD  SYSOUT=*           
//UNIQUES  DD  SYSOUT=*           
//*                               
//SYSIN    DD  *                 
 SORT FIELDS=(11,05,CH,A,         
               1,10,CH,A)         
 OUTFIL FNAMES=FULLSORT           
 OUTFIL FNAMES=UNIQUES,           
        REMOVECC,NODETAIL,       
        SECTIONS=(11,5,           
                   1,10,         
                  HEADER3=(1,15))
 END                             
//*-+----1----+                   
//SORTIN   DD  *                 
8888888888BBBBB                   
1111111111BBBBB   
7777777777BBBBB   
2222222222BBBBB   
8888888888ZZZZZ   
1111111111ZZZZZ   
7777777777ZZZZZ   
2222222222ZZZZZ   
8888888888BBBBB   
1111111111BBBBB   
7777777777BBBBB   
2222222222BBBBB   
8888888888ZZZZZ   
1111111111ZZZZZ   
7777777777ZZZZZ   
2222222222ZZZZZ   
8888888888BBBBB   
1111111111BBBBB   
7777777777BBBBB   
2222222222BBBBB   
8888888888ZZZZZ   
1111111111ZZZZZ   
7777777777ZZZZZ   
2222222222ZZZZZ   
//*               


The result in FULLSORT:
Code:

1111111111BBBBB   
1111111111BBBBB   
1111111111BBBBB   
2222222222BBBBB   
2222222222BBBBB   
2222222222BBBBB   
7777777777BBBBB   
7777777777BBBBB   
7777777777BBBBB   
8888888888BBBBB   
8888888888BBBBB   
8888888888BBBBB   
1111111111ZZZZZ   
1111111111ZZZZZ   
1111111111ZZZZZ   
2222222222ZZZZZ   
2222222222ZZZZZ   
2222222222ZZZZZ   
7777777777ZZZZZ
7777777777ZZZZZ
7777777777ZZZZZ
8888888888ZZZZZ
8888888888ZZZZZ
8888888888ZZZZZ


The result in UNIQUES:
Code:

1111111111BBBBB
2222222222BBBBB
7777777777BBBBB
8888888888BBBBB
1111111111ZZZZZ
2222222222ZZZZZ
7777777777ZZZZZ
8888888888ZZZZZ
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 8
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Execute secondary panel of sdsf with ... CLIST & REXX 1
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top