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

Include COND for comp-3


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jul 21, 2011 1:18 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Jul 21, 2011 1:35 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jul 21, 2011 1:42 pm
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Jul 21, 2011 3:25 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts Reference for COND parameter. JCL & VSAM 1
No new posts Interviewers are surprised with my an... Mainframe Interview Questions 6
Search our Forums:

Back to Top