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

Update the Sortout file with record count at defined pos


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

New User


Joined: 28 Mar 2008
Posts: 69
Location: 125.16.180.5

PostPosted: Tue May 17, 2016 8:52 pm
Reply with quote

Hello,

I would like to the count the number of records in sortin and update the record count at a certain posistion in the sortout file.

I am currently using
Code:


//STEP01 EXEC PGM=SYNCSORT                                             
//*                                                                     
//SORTIN   DD  *                                                       
10                                                                     
20                                                                     
30                                                                     
40                                                                     
/*                                                                     
//SORTOUT  DD  DSN=Test.sort.out.ps,DISP=SHR                   
//*                                                                     
//SYSIN    DD  *                                                       
   SORT FIELDS=COPY                                                     
   OUTFIL REMOVECC,NODETAIL,                                           
    TRAILER1=('NO OF RECORDS: ',COUNT=(M11,LENGTH=8))                   
//*                                                                     
//SYSPRINT DD  SYSOUT=*                                                 
//SYSOUT   DD  SYSOUT=*                                                 
//SYSUDUMP DD  SYSOUT=*                                                 



But - This sort card wipes out all the contents of the file I have in Test.sort.out.ps and prints the trailer line only whereas I would like to retain the content of the sortout file but only change a particular record and update it with record count from sortin.

How could I acheive this ? Thank you for your help!
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2567
Location: NYC,USA

PostPosted: Tue May 17, 2016 8:57 pm
Reply with quote

Get rid of
Code:
NODETAIL
.
Back to top
View user's profile Send private message
karthik_sripal

New User


Joined: 28 Mar 2008
Posts: 69
Location: 125.16.180.5

PostPosted: Tue May 17, 2016 9:03 pm
Reply with quote

Thank you very much for the quick response - but getting rid of Nodetail - gives me the records from sortin in my sortout - I dont want that either.

I would like to have the content - whatever is currently in the sortout to remain there and yet just replace/overlay only a certain row in my sortout with the count of the sortin records
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2567
Location: NYC,USA

PostPosted: Tue May 17, 2016 9:09 pm
Reply with quote

Quote:
I would like to retain the content of the sortout file but only change a particular record and update it with record count from sortin.

Quote:
replace/overlay only a certain row in my sortout with the count of the sortin records

How do you identify the record then? and why
Code:
Test.sort.out.ps
is in SORTOUT can you tell? you ideally wants to use in SORTIN and then process the logic and overlay the identified records and copy everything to SORTOUT.
Back to top
View user's profile Send private message
karthik_sripal

New User


Joined: 28 Mar 2008
Posts: 69
Location: 125.16.180.5

PostPosted: Tue May 17, 2016 9:11 pm
Reply with quote

Thanks again - Say the 10th record, 10th col - we want to overlay with count of records from sortin
Back to top
View user's profile Send private message
karthik_sripal

New User


Joined: 28 Mar 2008
Posts: 69
Location: 125.16.180.5

PostPosted: Tue May 17, 2016 9:14 pm
Reply with quote

My sortout file - Test.sort.out.ps is like this

Code:

Dat1
Dat2
Dat3


and say I want like my output like

Code:

Dat1
Dat2
Dat3 - sortin count - 4
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2567
Location: NYC,USA

PostPosted: Tue May 17, 2016 10:17 pm
Reply with quote

Tested.
Code:
//S1    EXEC  PGM=ICEMAN                                       
//SYSOUT    DD  SYSOUT=*                                       
//SORTIN DD *                                                 
10                                                             
20                                                             
30                                                             
40                                                             
//SYM DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)   
//SYSIN    DD    *                                             
   OPTION COPY                                                 
   OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,                       
     BUILD=(80X),                                             
     TRAILER1=('CNT,''',COUNT=(M11,LENGTH=4),C'''')           
//S2    EXEC  PGM=ICEMAN                   
//SYSOUT    DD  SYSOUT=*                   
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)     
//SORTIN DD *                               
DAT1                                       
DAT2                                       
DAT3                                       
//SORTOUT DD SYSOUT=*                       
//SYSIN    DD    *                         
   OPTION COPY                             
   INREC IFTHEN=(WHEN=(1,4,CH,EQ,C'DAT3'), 
     OVERLAY=(6:C'- NO OF RECORDS - ',CNT))


You may also be able to do with joinkeys and seq no concept.
Back to top
View user's profile Send private message
karthik_sripal

New User


Joined: 28 Mar 2008
Posts: 69
Location: 125.16.180.5

PostPosted: Wed May 18, 2016 12:17 am
Reply with quote

Thank you very much!
Back to top
View user's profile Send private message
John Del

New User


Joined: 27 Apr 2012
Posts: 42
Location: NY

PostPosted: Wed May 18, 2016 12:41 am
Reply with quote

Sortout with DISP=MOD instead of SHR

Edit to add - nevermind, missed that the OP wanted to modify a data record in the output dsn instead of preserve the data record in the sortout dataset.

Except for a log, I never liked to see SHR (or MOD) coded on sortout datasets.
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 Converting a file from PD to display ... SYNCSORT 4
No new posts Record count of RECFM=U tape file DFSORT/ICETOOL 17
No new posts SKIP LOCKED DATA in UPDATE statement DB2 9
This topic is locked: you cannot edit posts or make replies. Write Character to Hexadecimal file w... COBOL Programming 8
No new posts Checking the total counts inside a re... JCL & VSAM 5
Search our Forums:

Back to Top