MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SORT: sorting two vsams into one sequential output

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
gildan2020
Beginner


Joined: 07 Dec 2006
Posts: 17
Topics: 8

PostPosted: Mon Dec 18, 2006 4:37 am    Post subject: SORT: sorting two vsams into one sequential output Reply with quote

Hi all,

I'm trying to sort two vsam files together into one sequential output:
Code:

//STEP025  EXEC PGM=SORT,COND=(0,NE)                       
//SORTIN    DD DSN=abcd,DISP=SHR
//          DD DSN=efgh,DISP=SHR
//SORTOUT   DD DSN=abcdefgh,
//             DISP=(NEW,CATLG,DELETE),                   
//             DCB=(RECFM=VB,LRECL=32752,BLKSIZE=0),       
//             SPACE=(CYL,(3,3),RLSE)                     
//SORTWK01  DD SPACE=(CYL,(10,10),RLSE)                   
//SORTWK02  DD SPACE=(CYL,(10,10),RLSE)                   
//SYSOUT    DD SYSOUT=*                                   
//SYSUDUMP  DD SYSOUT=*                                   
//SYSIN     DD *
  SORT FIELDS=COPY
  RECORD TYPE=VB
  END
/*


But I got the following error:
VSAM OPEN ERROR (188)

Any ideas?
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Mon Dec 18, 2006 5:32 am    Post subject: Reply with quote

gildan2020,

Check the VSAM OPEN ERROR CODES and try to debug.
Code:


VSAM Open error codes

  136(88)  Not enough Virtual-Storage Space is available for Work Areas,
           Control Blocks, or Buffers.
  144(90)  An uncorrectable I/O error occurred while VSAM was Reading or
           Writing a catalog record.
  148(94)  No record for the data set to be opened was found in the
           available catalog(s) or an unidentified error occurred while
           VSAM was searching the catalog.
  152(98)  Security Verification failed; the password specified in the
           Access-Method Control Block for a specified level of access
           does not match the password in the catalog for that level of
           access.
  164(A4)  An uncorrectable I/O error occurred while VSAM was Reading the
           Volume Label.
  168(A8)  The data set is not available for the type of processing you
           specify, or an attempt was made to open a Reusable data set
           with the Reset option while another user had the data set.
  176(B0)  An error occurred while VSAM was attempting to fix a page of
           Virtual storage in Real storage.
  180(B4)  A VSAM catalog specified in JCL either does not exist or is
           not open, and no record for the data set to be opened was
           found in any other catalog.
  184(B8)  An uncorrectable I/O error occurred while VSAM was completing
           an I/O request.
  188(BC)  The data set indicated by the Access-Method Control Block is
           not of the type that may be specified by an Access-Method
           Control Block.
  192(C0)  An unusable data set was opened for output.
  232(E8)  Reset was specified for a nonreusable data set and the
           data set is not empty.
  236(EC)  A permanent Staging error occurred in MSS (Acquire).
  244(F4)  The Volume containing the Catalog Recovery area was not
           mounted and verified for output processing.

_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Mon Dec 18, 2006 5:37 am    Post subject: Reply with quote

you can not concatonate vsam. you need to use the SORTINnn DD Statement.
i.e. SORTIN01 for vsam 1 and SORTIN02 for vsam 2.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Dec 18, 2006 11:15 am    Post subject: Reply with quote

Dick is right that you can't concatenate VSAM files - this is a system restriction.

If each file is in sorted order on a common key, you can MERGE them using SORTIN01 and SORTIN02 and a MERGE statement.

Note that you can't use SORTIN01 or SORTIN02 for COPY or SORT, but you could copy the files one at a time to a non-VSAM temporary MOD file and then SORT the MOD file to the output data set.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
gildan2020
Beginner


Joined: 07 Dec 2006
Posts: 17
Topics: 8

PostPosted: Mon Dec 18, 2006 8:51 pm    Post subject: Reply with quote

I dun understand. This website is telling me otherwise: http://condor.depaul.edu/~jpetlick/JCL_05.html

So, if I can't use SORTIN01 or SORTIN02 for COPY or SORT, what should I use?
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Dec 19, 2006 11:56 am    Post subject: Reply with quote

What is it exactly you think that website is telling you? I don't see anything on that website that says you can concatenate VSAM files. I don't see anything on that website that says you can use SORTIN01 and SORTIN02 for COPY or SORT. That website does show an example of using SORTIN01 and SORTIN02 for MERGE as I indicated you could do in my previous post. But you can only do a MERGE if the VSAM files are each in sorted order by the same key and you want the output in sorted order by that key.

It's unclear from your posts what you actually want to do which makes it difficult to show you how to do it. In your original post, you show SORT FIELDS=COPY which would give you an output data set with the records from file1 followed by the records from file2 but your subject line says "sorting" not "copying". So which do you want to do, copy or sort? If you want to COPY the files into a non-VSAM output file, you can use this DFSORT/ICETOOL job:

Code:

//STEP025  EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1   DD DSN=abcd,DISP=SHR
//IN2   DD DSN=efgh,DISP=SHR
//OUT   DD DSN=abcdefgh,
//             DISP=(MOD,CATLG,DELETE),
//             DCB=(RECFM=VB,LRECL=32752,BLKSIZE=0),
//             SPACE=(CYL,(3,3),RLSE)
//TOOLIN    DD *
COPY FROM(IN1) TO(OUT) VSAMTYPE(V)
COPY FROM(IN2) TO(OUT) VSAMTYPE(V)
/*


If you want to SORT the two files into a non-VSAM output file, you can use a DFSORT/ICETOOL job like this where p is that starting position of the key (the data starts in position 5 after the RDW) and m is the length of the key:

Code:

//STEP025  EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1   DD DSN=abcd,DISP=SHR
//IN2   DD DSN=efgh,DISP=SHR
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT   DD DSN=abcdefgh,
//             DISP=(MOD,CATLG,DELETE),
//             DCB=(RECFM=VB,LRECL=32752,BLKSIZE=0),
//             SPACE=(CYL,(3,3),RLSE)
//TOOLIN    DD *
COPY FROM(IN1) TO(T1) VSAMTYPE(V)
COPY FROM(IN2) TO(T1) VSAMTYPE(V)
SORT FROM(T1) TO(OUT) USING(CTL1)
/*
//CTL1CNTL DD *
  SORT FIELDS=(p,m,BI,A)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
gildan2020
Beginner


Joined: 07 Dec 2006
Posts: 17
Topics: 8

PostPosted: Wed Dec 20, 2006 3:15 am    Post subject: Reply with quote

Hi, Yes that's wat I wanted.

Sorry for not being clear earlier. I got ur codes working now.

thanks.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group