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

SYNCSORT in Z/VSE


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

New User


Joined: 26 Apr 2020
Posts: 11
Location: India

PostPosted: Mon May 11, 2020 3:44 pm
Reply with quote

Hi,

I have a requirement to compare two VSAM F using SYNCSORT in Z/VSE. The record size of both the input files are same. The first 22 character length field is the key field in both the files. I want to find out all the records in file 2 matching with key field in file 1. I tried to write a sort jcl using JOINKEYS, but its giving errors. I am new in Z/VSE environment, so could someone please direct me to achieve this

Code:

// DLBL SRTJNF1,'file 1',0,VSAM,CAT=ID
// DLBL SRTJNF2,'file 2',0,VSAM,CAT=ID
// DLBL SORTOUT,'output file',0,VSAM,DISP=(,KEEP), RECORDS=(100,100),
                             RECSIZE=775,CAT=ID
// EXEC SORT
   SORT FIELDS= COPY
   JOINKEYS FILES=F1,FIELDS=(1,10,A)
   JOINKEYS FILES=F2,FIELDS=(1,10,A)
   REFORMAT FIELDS=(F2:1,775)
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1245
Location: Bamberg, Germany

PostPosted: Mon May 11, 2020 3:57 pm
Reply with quote

Please post the error msgs as well. Between your SORT FIELDS= and the following COPY should not be a blank, btw.
Back to top
View user's profile Send private message
nithinkarthika

New User


Joined: 26 Apr 2020
Posts: 11
Location: India

PostPosted: Mon May 11, 2020 4:09 pm
Reply with quote

Hi Joerg.

Thanks for your reply. Sorry, the space between SORT FIELDS and COPY is a typo.
Please find the error message below.

Code:

// DLBL SRTJNF1,'file1',0,VSAM,CAT=ID
1S03D INVALID STATEMENT
// DLBL SRTJNF1,'file2',0,VSAM,CAT=ID
1S03D INVALID STATEMENT
SYNCSORT for Z/VSE version number
SORT FIELDS=COPY
JOINKEYS FILES=F1,FIELDS=(1.22,A)
JOINKEYS FILES=F2,FIELDS=(1.22,A)
REFORMAT FIELDS=(F2:1,775)

WER115A  REQ'D PARM MISSING ON JOINKEYS STMT
WER115A  REQ'D PARM MISSING ON JOINKEYS STMT
WER234A  DIAG= 00000000 00000000 00000000  00000400 00370000 00000000
WER400A  CRITICAL ERROR, SORT TERMINATED
WER117A  PHASE 0 HAS CRITICAL ERROR

Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1245
Location: Bamberg, Germany

PostPosted: Mon May 11, 2020 4:23 pm
Reply with quote

It seems your allocation of F1 and F2 are wrong. Unfortunately I can't help with that.
Code:
// DLBL SRTJNF1,'file1',0,VSAM,CAT=ID
1S03D INVALID STATEMENT
// DLBL SRTJNF1,'file2',0,VSAM,CAT=ID
1S03D INVALID STATEMENT
Back to top
View user's profile Send private message
nithinkarthika

New User


Joined: 26 Apr 2020
Posts: 11
Location: India

PostPosted: Mon May 11, 2020 4:42 pm
Reply with quote

Is there any other methods to compare two files. I want to find all the records in file 2 matching with key field in file 1. The first 22 character length field is the key field in both the files.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2018
Location: USA

PostPosted: Mon May 11, 2020 4:43 pm
Reply with quote

nithinkarthika wrote:
Code:

JOINKEYS FILES=F1,FIELDS=(1.22,A)
JOINKEYS FILES=F2,FIELDS=(1.22,A)

You cannot specify field positions as "one point twenty two"

It must be "one comma twenty two"
Back to top
View user's profile Send private message
nithinkarthika

New User


Joined: 26 Apr 2020
Posts: 11
Location: India

PostPosted: Mon May 11, 2020 4:46 pm
Reply with quote

Hi Sergeyken,

Sorry, there were some issues while typing the code. Please find below the jcl statements and error message.

Code:

// DLBL SRTJNF1,'file 1',0,VSAM,CAT=ID
// DLBL SRTJNF2,'file 2',0,VSAM,CAT=ID
// DLBL SORTOUT,'output file',0,VSAM,DISP=(,KEEP), RECORDS=(100,100),
                             RECSIZE=775,CAT=ID
// EXEC SORT
   SORT FIELDS=COPY
   JOINKEYS FILES=F1,FIELDS=(1,22,A)
   JOINKEYS FILES=F2,FIELDS=(1,22,A)
   REFORMAT FIELDS=(F2:1,775)


output error message

Code:

// DLBL SRTJNF1,'file1 name',0,VSAM,CAT=ID
1S03D INVALID STATEMENT
// DLBL SRTJNF1,'file2 name',0,VSAM,CAT=ID
1S03D INVALID STATEMENT
SYNCSORT for Z/VSE version number
SORT FIELDS=COPY
JOINKEYS FILES=F1,FIELDS=(1,22,A)
JOINKEYS FILES=F2,FIELDS=(1,22,A)
REFORMAT FIELDS=(F2:1,775)

WER115A  REQ'D PARM MISSING ON JOINKEYS STMT
WER115A  REQ'D PARM MISSING ON JOINKEYS STMT
WER234A  DIAG= 00000000 00000000 00000000  00000400 00370000 00000000
WER400A  CRITICAL ERROR, SORT TERMINATED
WER117A  PHASE 0 HAS CRITICAL ERROR
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2018
Location: USA

PostPosted: Mon May 11, 2020 5:10 pm
Reply with quote

RTFM carefully!
Code:

 JOINKEYS  {FILE=F1   }
           {     F2   }
           {F1=ddname }
           {F2=ddname }
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1245
Location: Bamberg, Germany

PostPosted: Mon May 11, 2020 5:14 pm
Reply with quote

Could you try and omit the CAT=ID parameter for the DLBL allocation? It seems it either requires an additional DLBL statement if you want to use it but for VSAM it seems to not be necessary.
Back to top
View user's profile Send private message
nithinkarthika

New User


Joined: 26 Apr 2020
Posts: 11
Location: India

PostPosted: Mon May 11, 2020 6:12 pm
Reply with quote

Hi Joerg,

Thank you for assistance. The Invalid statement error has been resolved.
But the second error is still there, "REQ'D PARM MISSING ON JOINKEYS STMT". Not getting what PARM value is missing in the statements !
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1245
Location: Bamberg, Germany

PostPosted: Mon May 11, 2020 6:20 pm
Reply with quote

Please see what sergeyken has written:
Code:
JOINKEYS FILE=F1,FIELDS=(1,22,A)

and you have (FILES instead of FILE)
Code:
JOINKEYS FILES=F1,FIELDS=(1,22,A)

Hopefully it's just that. icon_wink.gif
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2018
Location: USA

PostPosted: Mon May 11, 2020 6:22 pm
Reply with quote

Joerg.Findeisen wrote:
Please see what sergeyken has written:
Code:
JOINKEYS FILE=F1,FIELDS=(1,22,A)

and you have (FILES instead of FILE)
Code:
JOINKEYS FILES=F1,FIELDS=(1,22,A)

Hopefully it's just that. icon_wink.gif

Those not able to RTFM, cannot read clear answers, too...
Back to top
View user's profile Send private message
nithinkarthika

New User


Joined: 26 Apr 2020
Posts: 11
Location: India

PostPosted: Mon May 11, 2020 7:18 pm
Reply with quote

Hi Sergeyken/Joerg,

I changed from FILES to FILE but no luck. I am getting the same error message, "REQ'D PARM MISSING ON JOINKEYS STMT".


Before
Code:

JOINKEYS FILES=F1,FIELDS=(1,22,A)
JOINKEYS FILES=F2,FIELDS=(1,22,A)
REFORMAT FIELDS=(F2:1,775)


After
Code:

JOINKEYS FILE=F1,FIELDS=(1,22,A)
JOINKEYS FILE=F2,FIELDS=(1,22,A)
REFORMAT FIELDS=(F2:1,775)
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2018
Location: USA

PostPosted: Mon May 11, 2020 7:42 pm
Reply with quote

nithinkarthika wrote:
Hi Sergeyken/Joerg,

I changed from FILES to FILE but no luck. I am getting the same error message, "REQ'D PARM MISSING ON JOINKEYS STMT".


Before
Code:

JOINKEYS FILES=F1,FIELDS=(1,22,A)
JOINKEYS FILES=F2,FIELDS=(1,22,A)
REFORMAT FIELDS=(F2:1,775)


After
Code:

JOINKEYS FILE=F1,FIELDS=(1,22,A)
JOINKEYS FILE=F2,FIELDS=(1,22,A)
REFORMAT FIELDS=(F2:1,775)

Are you sure you’re running the same code?

Are you sure you’re looking into the right log version?

Since you demonstrated inability to fix primitive syntax errors, I do not believe your presented information is correct.

Copy and paste THE FULL LOG WITH FULL ELEMENTS OF IT JUST COPIED, not re-typed manually, and not re-told by your own words. Otherwise it makes no sense to waste more time on you.
Back to top
View user's profile Send private message
nithinkarthika

New User


Joined: 26 Apr 2020
Posts: 11
Location: India

PostPosted: Mon May 11, 2020 7:57 pm
Reply with quote

Hi Sergeyken,

Please find the log copied directly from spool.


Code:

SYNCSORT FOR Z/VSE REL 3.7D
   SORT FIELDS=COPY                                                             
   JOINKEYS FILE=F1,FIELDS=(1,22,A)                                             
   JOINKEYS FILE=F2,FIELDS=(1,22,A)                                             
   REFORMAT FIELDS=(F2:1,775)                                                   
                                                                               
   WER115A  REQ'D PARM MISSING ON JOINKEYS STMT                                 
   WER115A  REQ'D PARM MISSING ON JOINKEYS STMT                                 
   WER234A  DIAG= 00000000 00000000 00000000 00000400 00370000 00000000         
   WER400A  CRITICAL ERROR, SORT TERMINATED   
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1245
Location: Bamberg, Germany

PostPosted: Mon May 11, 2020 8:16 pm
Reply with quote

Please let's change the JOINKEYS as follows:
Code:
JOINKEYS FILE=F1,FIELDS=(1,22,A)                                             
JOINKEYS FILE=F2,FIELDS=(1,22,A)

to
Code:
JOINKEYS F1=SRTJNF1,FIELDS=(1,22,A)                                             
JOINKEYS F2=SRTJNF2,FIELDS=(1,22,A)

and check one more time that those DLBL are defined correctly (1 and 2).
Code:
// DLBL SRTJNF1 ..
// DLBL SRTJNF2 ..
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2018
Location: USA

PostPosted: Mon May 11, 2020 9:33 pm
Reply with quote

nithinkarthika wrote:
Hi Sergeyken,

Please find the log copied directly from spool.


Code:

SYNCSORT FOR Z/VSE REL 3.7D
   SORT FIELDS=COPY                                                             
   JOINKEYS FILE=F1,FIELDS=(1,22,A)                                             
   JOINKEYS FILE=F2,FIELDS=(1,22,A)                                             
   REFORMAT FIELDS=(F2:1,775)                                                   
                                                                               
   WER115A  REQ'D PARM MISSING ON JOINKEYS STMT                                 
   WER115A  REQ'D PARM MISSING ON JOINKEYS STMT                                 
   WER234A  DIAG= 00000000 00000000 00000000 00000400 00370000 00000000         
   WER400A  CRITICAL ERROR, SORT TERMINATED   

The full log assumes everything, including JCL log, and JCL source
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1245
Location: Bamberg, Germany

PostPosted: Mon May 11, 2020 9:43 pm
Reply with quote

@sergeyken: This is a fact indeed. icon_exclaim.gif

It seems to me that the DD's are wrong. They were named SRTJNF1 and SRTJNF2 but should be SORTJNF1 and SORTJNF2 for FILE=Fn format. When switching to the Fn=DDname format the job should run. Otherwise I am temporary out of ideas here.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


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

PostPosted: Tue May 12, 2020 12:02 am
Reply with quote

And assuming they are sorted, may also try adding ,
Code:
JOINKEYS FILE=F1,FIELDS=(1,22,A),SORTED,NOSEQ


If nothing works then please write a program or use other utilities you have at your site.
Back to top
View user's profile Send private message
dneufarth

Active User


Joined: 27 Apr 2005
Posts: 419
Location: Inside the SPEW (Southwest Ohio, USA)

PostPosted: Tue May 12, 2020 12:27 am
Reply with quote

If I recall,

// DLBL filename, 'file-id',...

filename is limited to 7 characters in VSE

filename is equivalent to DD and file-id is equivalent to DSN in Z/OS
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2018
Location: USA

PostPosted: Tue May 12, 2020 5:51 pm
Reply with quote

Joerg.Findeisen wrote:
@sergeyken: This is a fact indeed. icon_exclaim.gif

It seems to me that the DD's are wrong. They were named SRTJNF1 and SRTJNF2 but should be SORTJNF1 and SORTJNF2 for FILE=Fn format. When switching to the Fn=DDname format the job should run. Otherwise I am temporary out of ideas here.

Don’t know how to overcome this:
firsttimeuser wrote:
I am new to computer, software, utilities, compiler, and scripts. I have the requirement to write something working on some type of computers. I don’t know exactly what to write, and where to put it all. I have this data
XXX YYY ZZZ AAA BBB CCC

Desired output is
111 222 333 444 555

But something goes wrong, and I do not get any result. Please help me to do my job, I want to get my salary
Back to top
View user's profile Send private message
nithinkarthika

New User


Joined: 26 Apr 2020
Posts: 11
Location: India

PostPosted: Wed May 13, 2020 9:29 am
Reply with quote

Rohit Umarjikar wrote:
And assuming they are sorted, may also try adding ,
Code:
JOINKEYS FILE=F1,FIELDS=(1,22,A),SORTED,NOSEQ


If nothing works then please write a program or use other utilities you have at your site.


I have added SORTED and NOSEQ. Now I am getting a new error message

Code:

JOINKEYS FILE=F1,FIELDS=(1,8,A),SORTED,NOSEQ
                                       *
JOINKEYS FILE=F1,FIELDS=(1,8,A),SORTED,NOSEQ
                                       *
REFORMAT FIELDS=(F2:1,775)
SORT FIELDS=COPY

WER047A  JOINKEYS STATEMENT HAS SYNTAX ERROR
WER047A  JOINKEYS STATEMENT HAS SYNTAX ERROR


If I remove NOSEQ from JOINKEYS, then getting the previous error message "REQ'D PARM MISSING ON JOINKEYS STMT". I tried NOSEQCK instead of NOSEQ as well, but no luck.
Back to top
View user's profile Send private message
nithinkarthika

New User


Joined: 26 Apr 2020
Posts: 11
Location: India

PostPosted: Wed May 13, 2020 9:32 am
Reply with quote

Joerg.Findeisen wrote:
Please let's change the JOINKEYS as follows:
Code:
JOINKEYS FILE=F1,FIELDS=(1,22,A)                                             
JOINKEYS FILE=F2,FIELDS=(1,22,A)

to
Code:
JOINKEYS F1=SRTJNF1,FIELDS=(1,22,A)                                             
JOINKEYS F2=SRTJNF2,FIELDS=(1,22,A)

and check one more time that those DLBL are defined correctly (1 and 2).
Code:
// DLBL SRTJNF1 ..
// DLBL SRTJNF2 ..


Hi Joerg,

I tried this method, but its failing with invalid statement error message.
Back to top
View user's profile Send private message
nithinkarthika

New User


Joined: 26 Apr 2020
Posts: 11
Location: India

PostPosted: Thu May 14, 2020 7:02 pm
Reply with quote

Finally sorted out..!!

For those who are working on Z/VSE or Z/VM...here is a working sort card for JOIN operation


Code:

// DLBL SORTIN1,'INPUT FILE 1',0,VSAM,CAT=ID
// DLBL SORTIN2,'INPUT FILE 2',0,VSAM,CAT=ID
// DLBL SORTOUT,'OUTPUT FILE',0,VSAM,DISP=(,KEEP), RECORDS=(XX,XX),RECSIZE=XX,CAT=ID
// DLBL SORTWKA,'Work dataset name', RECSIZE=xx, RECORDS=(xx,xx)
// EXEC SORT
   JOINKEYS FILES=F1,FIELDS=(1,10,A),TYPE=F/V,LRECL=XX,BLKSIZE=xx
   JOINKEYS FILES=F2,FIELDS=(1,10,A),TYPE=F/V,LRECL=XX,BLKSIZE=xx
   REFORMAT FIELDS=(F1/F2:XX,XX)
   SORT FIELDS= COPY
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


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

PostPosted: Thu May 14, 2020 7:52 pm
Reply with quote

Tough guess . Thanks for posting it back with solution.
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 Compare only first records of the fil... SYNCSORT 7
No new posts Count Records with a crietaria in a f... DFSORT/ICETOOL 5
No new posts DFSORT/SYNCSORT/ICETOOL JCL & VSAM 8
No new posts Syncsort "Y2C" Function SYNCSORT 1
No new posts Arithmetic division using Syncsort SYNCSORT 6
Search our Forums:

Back to Top