Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Comparing Comp-3 fields with greater than equal to condition

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Prateeksichem1

New User


Joined: 11 Jul 2018
Posts: 2
Location: US

PostPosted: Fri Jul 13, 2018 8:45 am    Post subject: Comparing Comp-3 fields with greater than equal to condition
Reply with quote

Hi,

I have 2 files
file1 of length 500
file2 of length 80

based on the matched keys, I need to compare Comp-3 field in file2 (length S9(13V99)) with the Comp-3 field in file1(length S9(13V99)).

file 2 field = -5000
file 1 field needs to be less than -5000 (like -6000)

when I'm running sort with below code, it gives me all the negative values not only lesser ones, need your help to achieve this. Thanks

JOINKEYS FILE=F1,FIELDS=(2417,3,A)
JOINKEYS FILE=F2,FIELDS=(0043,3,A)
REFORMAT FIELDS=(F1:1,2550,F2:1,200)
INCLUDE COND=(209,08,PD,LT,2555,08,PD)
SORT FIELDS=COPY
OUTREC FIELDS=(1:1,2550)

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

mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 310
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Fri Jul 13, 2018 11:50 am    Post subject:
Reply with quote

Can you post a snippet of input data with hex on. Please use the code tags.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2371
Location: @my desk

PostPosted: Fri Jul 13, 2018 6:13 pm    Post subject:
Reply with quote

Hello Prateek - welcome to the forums!
Quote:
file1 of length 500
file2 of length 80
Quote:

JOINKEYS FILE=F1,FIELDS=(2417,3,A)
JOINKEYS FILE=F2,FIELDS=(0043,3,A)
REFORMAT FIELDS=(F1:1,2550,F2:1,200)
Not related to your issue, but the length mentioned does not seem to be consistent with the position/lengths in your JOINKEYS/REFORMAT.
Back to top
View user's profile Send private message
sergeyken

Active User


Joined: 29 Apr 2008
Posts: 327
Location: Maryland

PostPosted: Fri Jul 13, 2018 7:19 pm    Post subject: Re: Comparing Comp-3 fields with greater than equal to condition
Reply with quote

Prateeksichem1 wrote:
Comp-3 field in file2 (length S9(13V99))

What "length" stands for??? icon_rolleyes.gif
What does this syntax mean - S9(13V99) - ??????? icon_exclaim.gif

All these stuff have nothing to do with your following SORT statements.

Please provide a clear, correct, and full explanation of your problem. We are here not to guess your hidden thoughts.
Back to top
View user's profile Send private message
Prateeksichem1

New User


Joined: 11 Jul 2018
Posts: 2
Location: US

PostPosted: Fri Jul 13, 2018 7:57 pm    Post subject:
Reply with quote

Sorry couldn't get you the full details... hope this makes little sense.

Length of both the fields are 8 bytes (S9(13V99) Comp-3).

Code:
hex values:
File 2  (-5000.00)

----+----1-------------
*****************
 Y Y........................
4E4E00000000
08080000500D


File 1  (-6201.50)

-1----+--------
....................
00000210
0000605D

in Output file I want all the values from file 1 - which is less than -5000.00 (file 2).
Just comparing 2 negative Comp-3 values using Sort and write in the output with lesser value but getting all the values (not only the lesser one).
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2371
Location: @my desk

PostPosted: Fri Jul 13, 2018 8:27 pm    Post subject:
Reply with quote

Whats your input, output RECFM,LRECL etc? Can you show some values that came into the output that you were not expecting (in hex). Use code tags (button) while posting data/code to preserve alignment.
Back to top
View user's profile Send private message
sergeyken

Active User


Joined: 29 Apr 2008
Posts: 327
Location: Maryland

PostPosted: Fri Jul 13, 2018 9:28 pm    Post subject:
Reply with quote

Prateeksichem1 wrote:
Sorry couldn't get you the full details... hope this makes little sense.

Length of both the fields are 8 bytes (S9(13V99) Comp-3)

Please, read about the syntax of COBOL first of all.

So far, period.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8361
Location: Dubuque, Iowa, USA

PostPosted: Fri Jul 13, 2018 9:50 pm    Post subject:
Reply with quote

Quote:
(S9(13V99) Comp-3).
This is not COBOL syntax. S9(13)V99 COMP-3 would be valid COBOL syntax for an 8-byte packed decimal variable with 2 decimal digits. If you are going to refer (repeatedly) to a language, you should at least make sure you've got the syntax correct.

Quote:
JOINKEYS FILE=F1,FIELDS=(2417,3,A)
JOINKEYS FILE=F2,FIELDS=(0043,3,A)
REFORMAT FIELDS=(F1:1,2550,F2:1,200)
INCLUDE COND=(209,08,PD,LT,2555,08,PD)
SORT FIELDS=COPY
OUTREC FIELDS=(1:1,2550)
Where, exactly, in here do you tell Sort to exclude records from F1 with a value more than -5000 (or include those records with a value less than -5000)? If you do not specify the restriction to Sort, are you expecting the product to read your mind?
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 429
Location: USA

PostPosted: Fri Jul 13, 2018 10:10 pm    Post subject: Reply to: Comparing Comp-3 fields with greater than equal to condition
Reply with quote

Robert, 5000 is sample data only. He wants the 'less than' condition on any amount.

Prateek, please provide meaningful lengths/position of keys and data and a meaningful sample data for Sort card.

.
Back to top
View user's profile Send private message
enrico-sorichetti

Senior Member


Joined: 14 Mar 2007
Posts: 10487
Location: italy

PostPosted: Sat Jul 14, 2018 1:29 am    Post subject: Reply to: Comparing Comp-3 fields with greater than equal to condition
Reply with quote

Quote:
I need to compare Comp-3 field in file2 (length S9(13V99)) with the Comp-3 field in file1(length S9(13V99)).


IMU ( In My Understanding ) the 5000 is just an example ...
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2033
Location: UK

PostPosted: Sat Jul 14, 2018 3:12 am    Post subject: Reply to: Comparing Comp-3 fields with greater than equal to condition
Reply with quote

Code:
2555,08,PD

Is this field ever positive with values in the other field > -5000 i.e. nearer 0?
Back to top
View user's profile Send private message
sergeyken

Active User


Joined: 29 Apr 2008
Posts: 327
Location: Maryland

PostPosted: Sat Jul 14, 2018 7:55 pm    Post subject: Re: Comparing Comp-3 fields with greater than equal to condition
Reply with quote

Prateeksichem1 wrote:
Hi,

I have 2 files
file1 of length 500
file2 of length 80

based on the matched keys, I need to compare Comp-3 field in file2 (length S9(13V99)) with the Comp-3 field in file1(length S9(13V99)).

file 2 field = -5000
file 1 field needs to be less than -5000 (like -6000) b

when I'm running sort with below code, it gives me all the negative values not only lesser ones, need your help to achieve this. Thanks

JOINKEYS FILE=F1,FIELDS=(2417,3,A)
JOINKEYS FILE=F2,FIELDS=(0043,3,A)
REFORMAT FIELDS=(F1:1,2550,F2:1,200)
INCLUDE COND=(209,08,PD,LT,2555,08,PD)
SORT FIELDS=COPY
OUTREC FIELDS=(1:1,2550)

Thanks
Prateek

Classical recommendations for a newbie:
1) use code tags in your posts
2) use correct syntax notation for any language
3) present examples of your input/output data
4) verify for yourself, and prove to the readers that you are using CORRECTLY calculated field offsets, sizes, etc (so far there is nothing)
5) use short test datasets specifically truncated for this test only! 1-10 records is enough to debug the code
6) print and demonstrate to the public ALL INVOLVED FIELDS! Not only ditty about "wrong final results"

There are hundreds of other obvious advices, but those above should be enough to start with.
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Remove duplicate record with condition rajiv rengasamy DFSORT/ICETOOL 4 Wed Jul 11, 2018 3:55 pm
No new posts KSDS file fields update by passing va... Anil Kumar Prajapati TSO/ISPF 5 Wed Jul 11, 2018 5:59 am
No new posts Comparing inside same file vickey_dw DFSORT/ICETOOL 2 Tue Jul 10, 2018 9:51 pm
This topic is locked: you cannot edit posts or make replies. Rexx code to find greater then symobl... Bharath Vikraman CLIST & REXX 8 Tue May 29, 2018 9:40 am
This topic is locked: you cannot edit posts or make replies. Difference between EQUAL and EQUAL TO... jithinraghavan COBOL Programming 3 Thu Apr 19, 2018 2:22 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us