Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Include COND for comp-3

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Thu Jul 21, 2011 12:57 pm    Post subject: Include COND for comp-3
Reply with quote

Hi,

Input file contains two records.

01 REC-LAYOUT.
05 FIELD-1 PIC S9(16)V9(2) COMP-3.
05 FIELD-2 PIC 9(1).


Code:

----+----1-
***********
          1
0000000000F
000001000F1
-----------
          2
0000000001F
000001001F2
-----------


Requirement is to exclude the record when Field-1 contains the value 1,00,000.00. Here 1st record has value 1,00,000.00, 2nd record has value 1,00,000.11.

But when i use the condition INCLUDE COND=(1,10,PD,NE,+100000.00)
i am getting both two records in the ouput. I want only the 2nd record as ouput.

Please share your thoughts.

Thanks
R KARTHIK
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Thu Jul 21, 2011 1:18 pm    Post subject: Reply to: Include COND for comp-3
Reply with quote

Your value does not conform to your PICture.

In your data it is "unsigned" (sign is F, assumed positive).

In you Cobol record layout it is signed (C would be positive).

If the record layout was used to create the data, something has gone wrong.

If you use the record layout to read the data, something could go wrong.

As to the sort, maybe, check the manual, the + you are using is forcing the test to expect sign C.

Edit: or maybe there is an unsigned version of PD.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Thu Jul 21, 2011 1:35 pm    Post subject: Reply to: Include COND for comp-3
Reply with quote

You should realize that SORT will not be concerned/understand the decimal positions and will treat everything as integer numbers

so ( forgive my cobol approximation, I am not that fluent in COBOL )
if You have a packed variable with two decimals 999.99 it will be stored in three bytes and from the sort point of view You should consider it as a <unorthodox> integer with no decimal
if COBOL understands the value as 123.45 SORT will understand just 12345 !

so just drop the decimals and carry on all the decimal point elucubrations Yourself icon_biggrin.gif

PS.
just tested with DFSORT ,
using INCLUDE COND=(1,10,PD,NE,+100000.00)
gives a return code 16, comparison field error under the decimal point,

something has not been told here

Bill, the sign does not make any difference, I just tested with both x'c' and x'f' signs and with a +xxx and xxx value,
the result does not change ( the output is correct )

what I do not understand, as i said , is how the TS can complain about bad output when the sort would never work as written!
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Thu Jul 21, 2011 1:42 pm    Post subject: Reply to: Include COND for comp-3
Reply with quote

That should do nicely enrico. Subject to the signs, which I have not much idea about in SORTs, but I think generally they are not bothered until it comes to 'rithmatic and a couple of other things.

A Note: INCLUDE with NE is equivalent to OMIT with EQ. To me the latter is clearer.

R Karthik, if you are, or will, using, or use, that layout for that data in a Cobol program, you are asking for trouble (potentially, not guaranteed - yet).
Back to top
View user's profile Send private message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Thu Jul 21, 2011 2:58 pm    Post subject: Reply to: Include COND for comp-3
Reply with quote

HI Enrico & Bill,

When i changed the condition to
INCLUDE COND=(1,10,PD,NE,+10000000), it omits the records with value 1,00,000.00. I will make sure the layout while using in COBOL.

I have added "if COBOL understands the value as 123.45 SORT will understand just 12345 ! " to my lessons learnt list.

Thanks for sharing your knowledge and time.

R KARTHIK
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8117
Location: East Dubuque, Illinois, USA

PostPosted: Thu Jul 21, 2011 3:25 pm    Post subject:
Reply with quote

There is a reason the V in a COBOL PICTURE clause is called an IMPLIED decimal point.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Include/omit with "ALL" pa... mgl DFSORT/ICETOOL 6 Wed Jun 14, 2017 2:31 pm
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
No new posts how to DYNAMICALLY write sort cond to... mohamedmubee COBOL Programming 13 Fri Aug 26, 2016 11:46 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us