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

COMP-3 field comparison


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
krupagk

New User


Joined: 07 Aug 2010
Posts: 13
Location: Hyderabad

PostPosted: Mon Nov 12, 2012 8:46 pm
Reply with quote

Hi All,

I have a COMP-3 field and i want to compare first 3 bytes of it. Can you help me with the JCL sort. Here is my field and my condition

03 : FIELD-A PIC S9(09) COMP-3.

My Condition is FIELD-A(1:3) NE 000 i.e. first three characters not equal to 000

Regards
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: Mon Nov 12, 2012 8:59 pm
Reply with quote

When you say three bytes of zero, do you mean you expec X'F0F0F0' (zoned/display decimal) or X'000000' (packed/comp-3/binary/comp/comp-4/comp-5) or what?

Show an example, in HEX, for the input and show what you want to do with it.
Back to top
View user's profile Send private message
krupagk

New User


Joined: 07 Aug 2010
Posts: 13
Location: Hyderabad

PostPosted: Mon Nov 12, 2012 9:43 pm
Reply with quote

Hi Bill,

Here is my input file

FIELD-X FIELD-A
31/AN 5/PS
(1-31) (228-232)
ZZZZZZZZZZZZZZZZZAAAAAAAAAAAAAA 0
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 44005643
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB 3554
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD 0
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC 0

Here only the 2nd record must come in output all other has to be skip as FIELD-A(1:3) is non zero's

Regards
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Mon Nov 12, 2012 9:59 pm
Reply with quote

krupagk wrote:
Hi All,

I have a COMP-3 field and i want to compare first 3 bytes of it. Can you help me with the JCL sort. Here is my field and my condition

03 : FIELD-A PIC S9(09) COMP-3.

My Condition is FIELD-A(1:3) NE 000 i.e. first three characters not equal to 000

Look at this this thread. Although it is in the DFSORT forum and you are either using Syncsort or posting in the wrong forum, the syntax should be identical.
Back to top
View user's profile Send private message
krupagk

New User


Joined: 07 Aug 2010
Posts: 13
Location: Hyderabad

PostPosted: Tue Nov 13, 2012 2:08 pm
Reply with quote

Hi Akatsukami,

Thanks for the update. Closing this post here and opening in SyncSort

Regards
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: Tue Nov 13, 2012 3:08 pm
Reply with quote

You are already in the correct forum for SyncSort. Your new duplicate in the DFSORT forum has been deleted.

What is curious, as Mr A. has noted, is that there is you and there is pavaniabbineni who seem to be working on the same thing.

pavaniabbineni is in DFSORT.

Are you working together? Or how do the tasks happend to be the same?

Test for X'000000' if leading zeros in a packed/comp-3 field.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Tue Nov 13, 2012 3:24 pm
Reply with quote

COMP-3 fields contain numbers, so you have to take a different approach:
being defined as PIC S9(9), values range between 999999999- and 999999999+.
The 3 left bytes cover the 6 leftmost digits. If they are zeroes then the range changes to 000000999- and 000000999+.
If in fact you only want to check the 3 leftmost digits. then the range of numbers will be 000999999- and 000999999+

Knowing this, it is now easy to INCLUDE/OMIT according to the correct range:
COND=(228,5,PD,LT,-999999,OR,228,5,PD,GT,+999999)
for example
Back to top
View user's profile Send private message
krupagk

New User


Joined: 07 Aug 2010
Posts: 13
Location: Hyderabad

PostPosted: Tue Nov 13, 2012 3:36 pm
Reply with quote

Hi Bill,

Thanks for the update. I am not sure about Pavaniabbineni.

Hi Marso,

Thanks a lot for the solution. I will try it and let you know the results

Regards
Back to top
View user's profile Send private message
krupagk

New User


Joined: 07 Aug 2010
Posts: 13
Location: Hyderabad

PostPosted: Tue Nov 13, 2012 6:30 pm
Reply with quote

Hi Marso,

It is working. Thanks a lot for your help.

Hi Bill,

I came to know that Pavaniabbineni is also working on the same task. We are in a team. I will tell her. Thank you

Hi All,

Thanks a lot for your help.

Regards
Daniel K Gadde
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Nov 13, 2012 7:54 pm
Reply with quote

Quote:
I came to know that Pavaniabbineni is also working on the same task. We are in a team.


pretty religious people around here icon_cool.gif

Quote:
Do not let your left hand know what your right hand is doing.

Matthews 6.4
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 Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts S0C7 - Field getting overlayed COBOL Programming 2
Search our Forums:

Back to Top