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

Record extraction using JCL Sort


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

New User


Joined: 31 Jan 2006
Posts: 39

PostPosted: Tue Apr 08, 2014 6:39 pm
Reply with quote

Using JCL Sort i need to get values from same byte position from 2 different Input files and write to a single output file, for the comparing purpose

eg From input FILE 1 extract data from postion 118 to 130 and 186 to 232
From Input FILE 2 extract data from postion 118 to 130 and 186 to 232

Output FILE 3 will have extracted data from FILE 1 and FILE 3 like below

file 1 contents file 2 contents
File 3 -> 118 to 130 186 to 232 118 to 130 186 to 232

Any helps is appreciable

Thanks
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Tue Apr 08, 2014 6:43 pm
Reply with quote

Sample input and output plus RECFM and LRECL would be useful but you may be able to do this with JOINKEYS.
Back to top
View user's profile Send private message
Sumeendar

New User


Joined: 31 Jan 2006
Posts: 39

PostPosted: Tue Apr 08, 2014 6:54 pm
Reply with quote

I used below Sort for the above objective, but Step S4 is failing with
AB = S013

Any help is appreciable

Code:
//S1       EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD DSN=I90496.INV250.CSP.C111PREM,DISP=SHR               
//SORTOUT DD DSN=&&TEMP,DISP=(NEW,PASS),                           
//         SPACE=(TRK,(50,50),RLSE),DCB=(RECFM=FB,LRECL=80)         
//SYSIN    DD    *                                                 
  OPTION COPY                                                       
  OUTREC FIELDS=(1:118,12,14:192,38)                               
/*                                                                 
//S2       EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD DSN=I90496.INV250.CSP.C111PREM.JAVA,DISP=SHR         
//SORTOUT DD DSN=&&TEMP1,DISP=(NEW,PASS),                           
//         SPACE=(TRK,(50,50),RLSE),DCB=(RECFM=FB,LRECL=80)         
//SYSIN    DD    *                                                 
  OPTION COPY                                                       
  OUTREC FIELDS=(1:118,12,14:192,38)                               
/*                                                                 
//S3       EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD DSN=&&TEMP,DISP=OLD                                   
//SORTOUT DD  DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)   
//SYSIN    DD    *                                                 
  OPTION COPY                                                       
  INREC BUILD=(C'FILE1VAL,''',1,60,C'''')                           
/*                                                                 
//S4       EXEC  PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)                             
//SYMNOUT  DD SYSOUT=*                                             
//SORTIN   DD DSN=&&TEMP1,DISP=OLD                                 
//SORTOUT  DD SYSOUT=*,DCB=(RECFM=FB,LRECL=200)                     
//SYSIN    DD *                                                     
  OPTION COPY                                                       
 OUTREC BUILD=(C'OUT',FILE1VAL,1,60)                               
/*


Code'd
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Apr 08, 2014 7:21 pm
Reply with quote

Hello,

You have not posted the diagnosticds you were presented by the run . . .

Is the s013 an s013-20?

Why have you not posted the requested data?
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


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

PostPosted: Wed Apr 09, 2014 3:30 am
Reply with quote

Sumeendar,

As told, are the input files sorted? is/are there any common key(s) between two files? if answer to this is yes then the quickest way is to use JOINKEYS.

How is(&&S1)
Quote:
Code:
 //SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)

being used here?

And as Dick suggested, please provide the SYOUT/Spool messages related to the failure for the exact rectifications and it is best practice to use a CODE tag.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


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

PostPosted: Wed Apr 09, 2014 3:43 am
Reply with quote

However if there is no common key then you can use the trick "Join fields from two files record-by-record" from the below link (ofcource please do necessary modifications as per your offset instead of a whole record),

ftp.software.ibm.com/storage/dfsort/mvs/sorttrck.pdf
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Apr 09, 2014 4:13 am
Reply with quote

You really have to clarify what it is you are trying to do.

Show a sample of data from both input files, and the expected output for that data, and a description of how that should happen.

Your S013 is probably because you haven't defined your SYMNAMES DSN as F/FB LRECL 80, which you could do by specifying an extra ..,80:X) where you are defining your record.

Please use BUILD instead of INREC/OUTREC FIELDS or OUTFIL OUTREC, which only exist for backwards-compatibility.

I don't think your generated symbol is doing what you want, even though I don't know what you want.
Back to top
View user's profile Send private message
Sumeendar

New User


Joined: 31 Jan 2006
Posts: 39

PostPosted: Wed Apr 09, 2014 11:19 am
Reply with quote

i have given SYMNAMES DSN as F/FB LRECL 80, by specifying an extra ..,80:X),

upon doing this my error as changs to ABENDU16 in Step S4 with below information

Code:
 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
   Display  Filter  View  Print  Options  Search  Help                         
 -------------------------------------------------------------------------------
 ISOE OUTPUT DISPLAY I9011324 JOB00082  DSID   108 LINE 0       COLUMNS 02- 81 
 COMMAND INPUT ===>                                            SCROLL ===> CSR 
********************************* TOP OF DATA **********************************
 SYNCSORT FOR Z/OS  1.4.1.0N    U.S. PATENTS: 4210961, 5117495   (C) 2010 SYNCSO

 WER513A  ERRORS IN SYMNAMES STATEMENTS                                         
 FILE1VAL,'VC111.243.1B C102                                           '       
 *                                                                             
 WER516A  DUPLICATE SYMBOL DEFINITION                                           
 FILE1VAL,'VC111.244.1B C102                                           '       
 *                                                                             
 WER516A  DUPLICATE SYMBOL DEFINITION                                           
 FILE1VAL,'VC111.245.1B C102                                           '       
 *                                                                             
 WER516A  DUPLICATE SYMBOL DEFINITION                                           
 FILE1VAL,'IC111.246.1B C102C111                                       '       
 *                                                                             
 WER516A  DUPLICATE SYMBOL DEFINITION                                           
 FILE1VAL,'VC111.122.1B C102C133                                       '       
 *                                                                             
 WER516A  DUPLICATE SYMBOL DEFINITION                                           
 FILE1VAL,'VC111.123.1B C102C133J129                                   '       
 *                                                                             
 WER516A  DUPLICATE SYMBOL DEFINITION                                           
 FILE1VAL,'VC111.124.1B C102C133                                       '       
 *                                                                             
 WER516A  DUPLICATE SYMBOL DEFINITION                                           
 FILE1VAL,'VC111.125.1B C102C133J129                                   '       
 *                                                                             
 WER516A  DUPLICATE SYMBOL DEFINITION                                           
 FILE1VAL,'IC111.126.1B C102C111C133J143                               '       
 *                                                                             
 WER516A  DUPLICATE SYMBOL DEFINITION                                           
 FILE1VAL,'VC111.127.1B C102C133                                       '       
 *                                                                             
 WER516A  DUPLICATE SYMBOL DEFINITION                                           
 FILE1VAL,'VC111.128.1B C102C133J129                                   '       
 *                                                                             
 WER516A  DUPLICATE SYMBOL DEFINITION


Code'd
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Apr 09, 2014 11:39 am
Reply with quote

Your have SyncSort (WER messages) not DFSORT, so your topic has been moved to the JCL forum where SyncSort questions live.

You have to take note of all that is said, and not just a bit which is superficially useful to you. I suggested your code would not work.

You are generating a symbol. Symbols have to be unique. Unless your file has only one record, this idea is not going to work.

If you describe, fully, answering anything remaining which was asked of you, there will probably be a reasonably short solution. But until we know what you want, including the compare part, there is not much point in suggesting anything.
Back to top
View user's profile Send private message
Sumeendar

New User


Joined: 31 Jan 2006
Posts: 39

PostPosted: Wed Apr 09, 2014 3:42 pm
Reply with quote

okay i will be more precise on what i need

I have one file (namely FILE1) with multiple records having values 'VC111.242.1B' residing in position 118 to 130 and values 'C102C118' residing in position 192 to 200'

Similarly I have another file (namely FILE2) with multiple records having values 'VC111.242.1B' residing in position 118 to 130 and values 'C102C240' residing in position 192 to 200'

Using JCL SORT, i need to generate a 3rd file (FILE3), which contains above FILE1 and FILE2 values residing in below manner

VC111.242.1B C102C118 VC111.242.1B C102C240

I tried using SYSNAMES, but that do not support with multiple records. Is there a any better solution using SORT utility to attain the above objective

Thanks in advance
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


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

PostPosted: Wed Apr 09, 2014 10:35 pm
Reply with quote

Would you be kind enough to look at what I said and asked?
Back to top
View user's profile Send private message
Sumeendar

New User


Joined: 31 Jan 2006
Posts: 39

PostPosted: Fri Apr 11, 2014 3:03 pm
Reply with quote

Thanks for providing the link -> ftp.software.ibm.com/storage/dfsort/mvs/sorttrck.pdf

This was really helpfull and indeed meet my requirements

Thanks again
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Apr 11, 2014 3:20 pm
Reply with quote

Sumeendar,

Please re-read all the posts and reply to the questions asked. Post some sample input records, some 4-5 records from both the files (showing relevant fields) and the expected output out of it and the rules by which you arrived at that output.
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 SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top