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 help needed in Processing VSAM Input file
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
eureka19
Beginner


Joined: 02 Oct 2005
Posts: 20
Topics: 9

PostPosted: Sun Oct 02, 2005 1:15 am    Post subject: Sort help needed in Processing VSAM Input file Reply with quote

Hi All,

I am trying to Sort a VSAM File. I have given the same file in SORTIN &
SORTOUT. But it is not working.

Below is the code & abend details.
Code:

//CUST1    EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SORTIN   DD DSN=TNBCV.TEST.FILE1.DATA,DISP=SHR,
//         AMP=('ACCBIAS=SO')
//SORTOUT  DD DSN=TNBCV.TEST.FILE1.DATA,DISP=SHR
//SYSIN DD *
 SORT FIELDS=(1,9,CH,A)
 INCLUDE COND=(133,2,CH,EQ,C'DC')
 OUTFIL FNAMES=SORTOUT,OUTREC=(1:1,132,133:C'CD',135,1065)
 INPFIL TOL,VSAM
 END
/*

Abend details:
********************************* TOP OF DATA **********************************
1ICE143I 0 BLOCKSET     SORT  TECHNIQUE SELECTED                               
 ICE000I 1 - CONTROL STATEMENTS FOR 5740-SM1, DFSORT REL 14.0 - 07:53 ON SAT OCT
0           SORT FIELDS=(1,9,CH,A)                                             
            INCLUDE COND=(133,2,CH,EQ,C'DC')                                   
            OUTFIL FNAMES=SORTOUT,OUTREC=(1:1,132,133:C'CD',135,1065)           
            INPFIL TOL,VSAM                                                     
            END                                                                 
 ICE201I 0 RECORD TYPE IS F - DATA STARTS IN POSITION 1                         
 ICE183A 1 CONDITIONS NOT MET TO USE THE SAME VSAM DATA SET FOR SORTIN   AND SORTOUT
 ICE052I 3 END OF DFSORT                                                       
******************************** BOTTOM OF DATA ********************************

Thanks,
Uday.
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Sun Oct 02, 2005 4:16 am    Post subject: Reply with quote

eureka19,

You are trying to sort the data on Colums 1 thro 9. This should be same as the key portion of the VSAM file. If the key starts on a different column or if the length of VSAM key is Not equal to 9 you may end up in trouble.

Since, VSAM is by default sorted on Key, remove the SORT fields and have it as SORT FIELDS=COPY to retain the order.

Try and let us know if this works,

Thanks,
Phantom
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: Sun Oct 02, 2005 10:24 am    Post subject: Reply with quote

Uday,

When you get a DFSORT error message such as:

ICE183A 1 CONDITIONS NOT MET TO USE THE SAME VSAM DATA SET FOR SORTIN AND SORTOUT

you need to look it up in the "DFSORT Messages, Codes and Diagnosis Guide" to find out what it means. You can access all of the DFSORT books from:

http://www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html

Here's a link to the doc for that message. It tells you what's wrong and what to do about it:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CM10/2.2.175?SHELF=&DT=20050119125222&CASE=

Additionally, you should use an OUTREC statement instead of an OUTFIL statement when you use the same VSAM data set for input and output:

Code:

   OUTREC FIELDS=(1:1,132,133:C'CD',135,1065)


and you should remove the INPFIL statement since its ignored (it's a DFSORT/VSE statement, not a DFSORT/MVS statement).

Phantom said
Quote:
Since, VSAM is by default sorted on Key, remove the SORT fields and have it as SORT FIELDS=COPY to retain the order.


You can't use the same VSAM data set as input and output for a COPY or MERGE - you can only do that for a SORT and it requires the appropriate parameters as described in the ICE183A message.
_________________
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
eureka19
Beginner


Joined: 02 Oct 2005
Posts: 20
Topics: 9

PostPosted: Sun Oct 02, 2005 11:54 pm    Post subject: Reply with quote

It is still not working even after modification.
Please find the modified code
Code:

//*
//CUST1    EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SORTIN   DD DSN=TNBCV.TEST.FILE2,DISP=SHR,
//         AMP=('ACCBIAS=SO')
//SORTOUT  DD DSN=TNBCV.TEST.FILE2,DISP=SHR
//SYSIN DD *
 SORT FIELDS=COPY
 INCLUDE COND=(133,2,CH,EQ,C'DC')
 OUTREC FIELDS=(1:1,132,133:C'CD',135,1065)
 END
/*
//*

Here i have created File 2 with REUSE Option,yet it is giving me the same abend.But now it says Data starts in position 5.
Here is the help info i found.
Code:

   ICE183A   CONDITIONS NOT MET TO USE THE SAME VSAM DATA SET FOR indd AND
             outdd



Explanation: Critical. The indd DD statement and outdd DD statement both specified the same VSAM data set, but one of the following conditions prevented DFSORT from using the same VSAM data set for input and output:

The application is a copy or merge

NOVSAMIO is in effect

NORESET is in effect

The VSAM data set is not defined with REUSE
I am not getting wat to do for NORESET & NOVSAMIO

Thanks,
Eureka
Abend Details:
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Mon Oct 03, 2005 12:57 am    Post subject: Reply with quote

Eureka19,

Did you read what Frank Said.
Quote:

You can't use the same VSAM data set as input and output for a COPY or MERGE - you can only do that for a SORT and it requires the appropriate parameters as described in the ICE183A message.


My suggestion of using SORT FIELDS=COPY will not work. You need to use SORT FIELDS=(key,length,CH,A). Follow the instructions provided in ICE183A Message.

Thanks,
Phantom
Back to top
View user's profile Send private message
eureka19
Beginner


Joined: 02 Oct 2005
Posts: 20
Topics: 9

PostPosted: Mon Oct 03, 2005 1:09 am    Post subject: Reply with quote

Phantom,

I tried initially with SORT FIELDS=(1,9,CH,A)

In your reply, you have suggested to try with sort fields=copy
Since, VSAM is by default sorted on Key, remove the SORT fields and have it as SORT FIELDS=COPY to retain the order.

i tried again.. no success yet.

Thnks,
Eureka.
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Mon Oct 03, 2005 1:38 am    Post subject: Reply with quote

eureka19,

Quote:

In your reply, you have suggested to try with sort fields=copy


I admit that my suggestion was wrong.

Did you follow the instructions provided in ICE183A Message ? If you did and still get an error, paste your complete JCL and error message for us to review.

Also let us know, What is the key portion of your VSAM file ? (first 9 bytes ??? or something else ?).

PS. When you post any code, pls enclose that within the BB Tags {code} and {/code} (You need to change '{' by '[' & '}' by ']'). This makes your code legible to read and understand.

Thanks,
Phantom
Back to top
View user's profile Send private message
eureka19
Beginner


Joined: 02 Oct 2005
Posts: 20
Topics: 9

PostPosted: Mon Oct 03, 2005 3:59 am    Post subject: Reply with quote

Phantom,

Problem is not solved yet.I am not able to implement these two points which were in ICE183A Message.

NOVSAMIO is in effect
NORESET is in effect

Please find the code below.
Code:

//ISIAMAPX JOB (,B038),'ISIAMAP',
//         CLASS=A,
//         NOTIFY=&SYSUID,
//         MSGCLASS=H,
//         REGION=6M
//*
//CUST1    EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SORTIN   DD DSN=TNBCV.TEST.FILE2,DISP=SHR,
//         AMP=('ACCBIAS=SO')
//SORTOUT  DD DSN=TNBCV.TEST.FILE2,DISP=SHR
//SYSIN DD *
 SORT FIELDS=COPY
 INCLUDE COND=(133,2,CH,EQ,C'DC')
 OUTREC FIELDS=(1:1,132,133:C'CD',135,1065)
 END
/*
//*

Abend Message:
Code:

ICE143I 0 BLOCKSET     COPY  TECHNIQUE SELECTED                               
ICE000I 1 - CONTROL STATEMENTS FOR 5740-SM1, DFSORT REL 14.0 - 23:28 ON SUN OCT
           SORT FIELDS=COPY                                                   
           INCLUDE COND=(133,2,CH,EQ,C'DC')                                   
           OUTREC FIELDS=(1:1,132,133:C'CD',135,1065)                         
           END                                                                 
ICE201I 0 RECORD TYPE IS V - DATA STARTS IN POSITION 5                         
ICE183A 0 CONDITIONS NOT MET TO USE THE SAME VSAM DATA SET FOR SORTIN   AND SORTOUT
ICE052I 3 END OF DFSORT                                                       

Please review the code and let me know how it can be done.

Thanks,
Eureka
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Mon Oct 03, 2005 4:36 am    Post subject: Reply with quote

Eureka19,

The message ICE183A says:
Quote:

NOVSAMIO is in effect
NORESET is in effect


All you need is to reset these options to VSAMIO & RESET. Try this.

Code:

//CUST1   EXEC  PGM=SORT,PARM='VSAMIO,RESET'


Also, you need to keep this in mind. Your VSAM must be defined with REUSE option during creation.
Quote:

If VSAMIO and RESET are in effect, a data set defined with REUSE can be used
for both input and output for a sort; that is, the data set can be sorted in-place.


When you post any code use BBTags as shown below.
{code}
code-line 1
code-line 2
code-line 3
....
{/code}

As mentioned earlier change '{' by '[' & '}' by ']'.

Thanks,
Phantom
Back to top
View user's profile Send private message
eureka19
Beginner


Joined: 02 Oct 2005
Posts: 20
Topics: 9

PostPosted: Mon Oct 03, 2005 7:31 am    Post subject: Reply with quote

Phantom,

Job ran successfully. But all the records got deleted.
Fie is empty now.Sad

Code:

//CUST1    EXEC PGM=SORT,PARM=(VSAMIO,RESET)
//SYSOUT   DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SORTIN   DD DSN=TNBCV.TEST.FILE3,DISP=SHR,
//         AMP=('ACCBIAS=SO')
//SORTOUT  DD DSN=TNBCV.TEST.FILE3,DISP=SHR
//SYSIN DD *
 SORT FIELDS=(1,9,CH,A)
 INCLUDE COND=(133,2,CH,EQ,C'DC')
 OUTREC FIELDS=(1:1,132,133:C'CD',135,1065)
 END
/*
//*


Eureka
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Mon Oct 03, 2005 7:51 am    Post subject: Reply with quote

Eureka19,

Quote:

Fie is empty now


Could be because of two reasons.
1. No records matched your INCLUDE COND. Just check if your original dataset (if you have a copy) had any DC @ column 133.

2. If it had, then it has to do something with using same VSAM as Input & Output. Probably we need to give some other parameters.

Lets wait for Frank / Kolusu.

And one small thing. You followed by instruction of using BBTags correctly but missed one little point. I said you need to change '{' by '[' and '}' by ']'. Only then you get the correct formatting. better luck next time. Wink

Thanks,
Phantom
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 Oct 03, 2005 11:54 am    Post subject: Reply with quote

Eureka,

If all of the records were deleted, then none of them matched your INCLUDE condition. Look at the ICE201I message. If it says F, then the first data byte starts in position 1. If it says V, then the first data byte starts in position 5. Make sure your starting position for the INCLUDE statement reflects the correct position of the first data byte.

If you want to check what's in your INCLUDE field, use this job:

Code:

//SHOW    EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN=TNBCV.TEST.FILE3,DISP=SHR,
//         AMP=('ACCBIAS=SO')
//SORTOUT  DD SYSOUT=*
//SYSIN DD *
   OPTION COPY
   OUTREC FIELDS=(133,2,CH,X,133,2,HEX)
/*

_________________
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
eureka19
Beginner


Joined: 02 Oct 2005
Posts: 20
Topics: 9

PostPosted: Tue Oct 04, 2005 12:52 am    Post subject: Reply with quote

Frank,

Thanks a lot. It is working now.
Please find the modified code.
Code:

//CUST1    EXEC PGM=SORT,PARM=(VSAMIO,RESET)
//SYSOUT   DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SORTIN   DD DSN=TNBCV.TEST.FILE3,DISP=SHR,
//         AMP=('ACCBIAS=SO')
//SORTOUT  DD DSN=TNBCV.TEST.FILE3,DISP=SHR
//SYSIN DD *
 SORT FIELDS=(5,9,CH,A)
 INCLUDE COND=(137,2,CH,EQ,C'CD')
 OUTREC FIELDS=(1,4,5:5,131,137:C'DD',139,1060)
 END
/*
//*


But cant i copy the records as it is which do not satisfy the condition.
I mean suppose i have 100 records initially. there are only 2 records which satisy our condition i.e. 137,2 EQ CD. Only these records should be updated to DD and rest of the records should be copied as it is.

Presently after sort we are having 2 records only Sad

Please let me know how can we achive this.

Thanks a lot Frank & Phantom

Eureka.
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Tue Oct 04, 2005 1:13 am    Post subject: Reply with quote

Eureka19,

Check the following SORT Flow Diagram,
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA00/FIGSTMTSEQ?SHELF=&DT=20031124143823&CASE=&ScrollTOP=FIGSTMTSEQ#FIGSTMTSEQ

Irrespective of where you specify INCLUDE in the sort card, the order of execution of DFSORT statements follow the order specified in the diagram. So, when you use INCLUDE COND, only two records are taken in for processing from the input file. SORT, SUM, OUTREC, OUTFIL etc...all these statements run only on these two records.

For your case, you need to go for the CHANGE operator in INREC/OUTREC. Use the sort card below.
Code:
 
 SORT FIELDS=(5,9,CH,A)
 OUTREC FIELDS=(1,4,
                5,131,
                137,2,CHANGE=(2,C'CD',C'DD'),NOMATCH=(137,2),
                139,1060)


For more information on CHANGE operator, go thro' the information provided in the link below.
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ice1ca00/3.13?DT=20031124143823

(Search for NOMATCH in the page).

Hope this solves the problem,

Thanks,
Phantom
Back to top
View user's profile Send private message
eureka19
Beginner


Joined: 02 Oct 2005
Posts: 20
Topics: 9

PostPosted: Tue Oct 04, 2005 1:25 am    Post subject: Reply with quote

Thanks a lot Phantom.... Smile
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
Goto page 1, 2  Next
Page 1 of 2

 
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