Home      Mainframe Forum      Mainfarme Tutorials      IBM Manuals      Mainframe Interview Questions      Mainframe Books      IT News     SiteMap     Downloads


     
 
MAINFRAME - TIP OF THE DAY : When you specified V for RECFM parameter, LRECL value is largest record in the file plus 4 bytes. These four bytes contain the actual length of each variable length record in the file

Google
 
Web mainframegurukul.com

DFSORT Sorting a pack decimal field.

 
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities
  View previous topic :: View next topic  
Author Message
gonzalezw
Member


Joined: 27 Nov 2010
Posts: 7

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
1 salutes

PostPosted: Wed Mar 30, 2011 9:30 pm    Post subject: DFSORT Sorting a pack decimal field. Reply with quote

Using DFSORT how can I sort por "one" number in a pack decimal field.
If the field has a part numbe S9(7) COMP-3 and it has '0003864358421C'
menaing PD = each byte will have 00 03 86 43 58 42 1C and want to sort the fourth byte (which has 43) but I only want to sort the "3" or '5' in descending order. Then I want to select those records on an output file..

These I think is a problem if I put:
SORT FIELDS=(4,1,PD,D,)
OUTFIL INCLUDE=(4,1,BI,EQ,3,4,1,BI,EQ,5) or
OUTFIL INCLUDE=(4,1,PD,EQ,3,4,1,PD,EQ,5)

This will sort 43 and not 3 and in case of descending it will put put a 23 or 33 or any combination of a high number before the "3" before a "15" or "25" etc.

I look at the PD0 but it does not apply to this example.

Again all I want to do is sort one digit within a pack field which has two digits in each byte.

Thanks
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.

Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 812
Location: San Jose, CA

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Mar 30, 2011 10:33 pm    Post subject: Reply with quote

Your explanation of what you want to do is very confusing, especially your OUTFIL statements which have incorrect syntax.

Quote:
but I only want to sort the "3" or '5' in descending order


Huh? I can't figure out what you mean by this.

If you want to SORT on the second PD digit in the 4th byte, you can use a SORT statement like this:

Code:

  SORT FIELDS=(4.4,0.4,BI,D) 


If you want to SORT on the first PD digit in the 5th byte, you can use a SORT statement like this:

Code:

  SORT FIELDS=(5,0.4,BI,D) 


If you want to sort on the second PD digit in the 4th byte and on the first PD digit in the 5th byte, you can use a SORT statement like this:

Code:

  SORT FIELDS=(4,2,PD0,D)


If you want to do something else, you need to explain more clearly what it is exactly that you want to do.
_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
gonzalezw
Member


Joined: 27 Nov 2010
Posts: 7

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Thu Mar 31, 2011 11:21 pm    Post subject: Re: DFSORT Sorting a pack decimal field. Reply with quote

Hello again.
I want to apologize for not explaining well what I wanted although you already answer part of the original question.

Let me rephrase it.

I have a field which is defined as PIC S9(7) COMP-3.

The field is holding the following numbers: 00 03 86 43 58 42 1C for the first record.
That is byte one has 00, byte two has 03, byte three has 86, byte four has 43, byte five has 58, byte six has 42 and byte seve has 1C (they are in pack decimal format). This is example one but the next record has 00 04 72 35 12 31 2C and the following will have 00 32 66 87 99 21 3C (meaning the number changes base on part number). The right most number of the fourth byte has a special meaning there fore I want to sort ONLY for that number.

I used the following code:
SORT FIELDS=(4,1,PD,D,)
OUTFIL INCLUDE=(4,1,BI,EQ,3,4,1,BI,EQ,5) or
OUTFIL INCLUDE=(4,1,PD,EQ,3,4,1,PD,EQ,5)

This will sort the fourth byte but the two positions.

What I want is to sort for the number 3 on the first number and number 5 on the second number which is the right most number of the fourth byte. Because this numbers changes base on the part number I also want to select only those parts which have a 3 or a 5 in the rightmost of the fourth byte. That is where I put the OUTFIL INCLUDE= statement but in there I need to tell the sort to only include the output file only those records which have a 3 or a 5 on the rightmost number of the fourth byte. In the above numbers the third record will not be selected because it has a 7 on the right most position of the fourth byte. The output file I want it to be sorted in descending order.

Thanks a million. I hope my question is clearer now.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 812
Location: San Jose, CA

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Thu Mar 31, 2011 11:44 pm    Post subject: Reply with quote

Your OUTFIL syntax is incorrect. But you don't need OUTFIL statements unless you are trying to put the '3' records in one file and the '5' records in another file. Assuming you really just want the '3' and '5' records in one output file, you can use these DFSORT statements to do what you asked for:

Code:
 
   INCLUDE COND=(4,1,BI,EQ,B'....0011',OR,4,1,BI,EQ,B'....0101')   
   SORT FIELDS=(4.4,0.4,BI,D)                                       

_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
gonzalezw
Member


Joined: 27 Nov 2010
Posts: 7

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri Apr 01, 2011 1:06 am    Post subject: Reply with quote

Thank You so much - you guys are nothing but the best. It worked fine.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 812
Location: San Jose, CA

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri Apr 01, 2011 1:42 am    Post subject: Reply with quote

"you guys"? It was just you and me in this thread as far as I could see.

Anyway, glad I could help.
_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
arif
Member


Joined: 24 Sep 2014
Posts: 2

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri Oct 31, 2014 12:24 pm    Post subject: changeing sign Reply with quote

how to change the sign from positive to negative for a given number
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
William Collins
Active Member


Joined: 24 May 2012
Posts: 732

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri Oct 31, 2014 12:51 pm    Post subject: Reply with quote

You should post this as a new question. Subtract it from zero.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
academyindia4
Guest





Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Jan 25, 2016 9:32 pm    Post subject: Topic deleted by Admin Reply with quote

<< Content deleted By Admin >>
Back to top
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Display posts from previous:   
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & 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


Cobol Tutorial
This cobol tutorial covers most of the important topics like STRING, UNSTRING, COMP, COMP-3.....
DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. Explains in simple language. Some Chapters are locked, Forum members have free access to these chapters
CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming...
JCL Tutorial
This is most popular JCL tutorial from mainframegurukul. It does contain important jcl ....
SORT Tutorial
This Tutorial covers all important aspects of DFSORT. Has more SORT examples
INTERVIEW Questions
This page covers important interview questions
Mainframe Jobs
Mainframe Jobs posted by members of mainframegurukul forum
FaceBook Page
MainframeGurukul FaceBook Page
LinkedIn Page
MainframeGurkul Linkedin Page

This widget requires Flash Player 9 or better







Go to top of the page
 

Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  DB2 INTERVIEW QUESTIONS ||  COBOL INTERVIEW QUESTIONS  ||  JCL INTERVIEW QUESTIONS ||  JCL2 INTERVIEW QUESTIONS ||  VSAM INTERVIEW QUESTIONS ||  CICS INTERVIEW QUESTIONS  ||  Online tutorials ||  Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  SiteMap  ||  Expeditor Tutorial  ||  FILE-AID Tutorial  ||  Changeman Tutorial  ||  COBOL   ||  DB2   ||  JCL  ||  CICS  ||  VSAM  ||  DB2 Interview Questions ( 110 )   || Simple JCL Tutorials  || JCL Tutorial from MainframeGurukul.com   || Simple JCL Tutorial - Chapter1 ;|| Mainframe Forum - Tutorials  || Mainframe Tutorials || Mainframe CICS tutorial|| Mainframe COBOL Tutorial

Drona Educational Forums - Mainframe Cobol DB2 CICS Board
Powered by phpBB

mainframetopic-5752.html