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

Selection For Comp-3 fileds


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

New User


Joined: 27 Mar 2006
Posts: 31

PostPosted: Wed Apr 28, 2010 5:43 am
Reply with quote

Hi,

I have one variable :

GOD53-ORD-NO-- PIC S9(10)V USAGE COMP-3.

and in my input file this filds has millions of records , I want to pick up one which has the value : 520565. And I have written the following sort to get the data but some how its not working , could you please tell me that what will be the correct syntex for this :

171,6,PD,EQ,'520565')


--171-Starting postion
--6-total length of the field.
--PD -because its a COMP-3.

Note : I tried couple of options by giving
171,6,PD,EQ,X'520565') and 171,6,PD,EQ,P'520565') AND BY giving leading zero in 520565 to make it look like file value, but no success.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Apr 28, 2010 6:16 am
Reply with quote

Have you tried it without the quotes, such as 171,6,PD,EQ,+520565)?

How about posting the cut&paste of your JCL and all the output from the logs?
Back to top
View user's profile Send private message
harry

New User


Joined: 27 Mar 2006
Posts: 31

PostPosted: Wed Apr 28, 2010 6:22 am
Reply with quote

Q-Have you tried it without the quotes ?

Ans: yes I did ..

this is the copy paste of the jcl ;

===========================================

SORT FIELDS=COPY
INCLUDE COND=
((115,18,CH,EQ,C'77901TA0 A000 ',OR, <<PART NUMBER
115,18,CH,EQ,C'77901TA0 A100 '),AND, <<PART NUMBER
96,6,CH,EQ,C'210560',AND, <<<SUPP-CD
102,2,CH,EQ,C'01',AND, <<<SUPP-LOC
Quote:
171,6,PD,EQ,X'520565') <<<ORD-NUMBER

*
Back to top
View user's profile Send private message
harry

New User


Joined: 27 Mar 2006
Posts: 31

PostPosted: Wed Apr 28, 2010 6:27 am
Reply with quote

ERROR LOG

Code:
SYNCSORT FOR Z/OS  1.3.2.1R   
 2007 SYNC
                                                      z/OS   1.11.0         
SYNCSORT LICENSED FOR CPU SERIAL NUMBER 434F0, MODEL 2094 605             LIC
SYSIN :                                                                     
=============================================
  SORT   FIELDS=COPY                                                         
  INCLUDE COND=((115,18,CH,EQ,C'77901TA0 A000     ',OR, <<PART NUMBER       
                115,18,CH,EQ,C'77901TA0 A100     '),AND, <<PART NUMBER       
                96,6,CH,EQ,C'210560',AND,              <<<SUPP-CD           
                102,2,CH,EQ,C'01',AND,                 <<<SUPP-LOC           
                171,6,PD,EQ,X'520565')                 <<<ORD-NUMBER         
                            *                                               
WER253A  INCLUDE/OMIT FORMATS INCOMPATIBLE                                   
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                               


WER253A  INCLUDE/OMIT FORMATS INCOMPATIBLE       
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Apr 28, 2010 6:31 am
Reply with quote

Hi,

what happened when you tried it without the quotes ?


Gerry
Back to top
View user's profile Send private message
harry

New User


Joined: 27 Mar 2006
Posts: 31

PostPosted: Wed Apr 28, 2010 6:40 am
Reply with quote

gcicchet wrote:
Hi,

what happened when you tried it without the quotes ?


Gerry


Tired two option based on your comment : both gave MAXCC=0 but no results , I am 100% sure about my starting position and rec-length so what i think is its not understanding the value of ord-number , any idea is there different way to write COMP-3 ??? my value is =

Code:
===========
000255
00506C            which is nothing but 520565
==========


Option-1

  INCLUDE COND=((115,18,CH,EQ,C'77901TA0 A000     ',OR, <<PART NUMBER 
                115,18,CH,EQ,C'77901TA0 A000     '),AND, <<PART NUMBER
                96,6,CH,EQ,C'210560',AND,              <<<SUPP-CD     
                102,2,CH,EQ,C'01',AND,                 <<<SUPP-LOC     
                171,6,PD,EQ,00000520565)               <<ORD-NUMBER   

option-2

INCLUDE COND=((115,18,CH,EQ,C'77901TA0 A000     ',OR, <<PART NUMBER
              115,18,CH,EQ,C'77901TA0 A000     '),AND, <<PART NUMBER
              96,6,CH,EQ,C'210560',AND,              <<<SUPP-CD     
              102,2,CH,EQ,C'01',AND,                 <<<SUPP-LOC   
              171,6,PD,EQ,520565)               <<ORD-NUMBER       
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Apr 28, 2010 7:04 am
Reply with quote

Hi,

is the file FB or VB ?

Have you tried selecting 1 single field to see if you have the correct starting positions ?

Also 115,18, means you are searching from 115-132, the string you are searching for is only 14 bytes long C'77901TA0 A000 ' so unless 129-132
has spaces in it, you will not select anything.


Gerry
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Apr 28, 2010 7:12 am
Reply with quote

harry wrote:
Code:
                171,6,PD,EQ,X'520565')                 <<<ORD-NUMBER         
                            *                                               
WER253A  INCLUDE/OMIT FORMATS
This is without quotes?
harry wrote:
Code:
Option-1
.
                171,6,PD,EQ,00000520565)               <<ORD-NUMBER   
.
option-2
.
              171,6,PD,EQ,520565)               <<ORD-NUMBER       
Either should work, since there are no error messages with them, right?

I suggest you display/browse the input file and 'hex on' and cut&paste the first screen of data and the screen centering on position 171.

Please post the current JCL and the sysouts produced by the run with that JCL and the results that "gave MAXCC=0 but no results".

By the way, just cur &paste and wrap in 'code' rather than 'quote'. And no bolding/underlining/color/font size is needed, we can find the needed info without that stuff........
Back to top
View user's profile Send private message
harry

New User


Joined: 27 Mar 2006
Posts: 31

PostPosted: Wed Apr 28, 2010 7:15 am
Reply with quote

Quote:
Hi,

is the file FB or VB ?

Have you tried selecting 1 single field to see if you have the correct starting positions ?

Also 115,18, means you are searching from 115-132, the string you are searching for is only 14 bytes long C'77901TA0 A000 ' so unless 129-132
has spaces in it, you will not select anything.
Quote:


Ans:

Ans-1 : This is a FB,

Ans-2 :
Yes 115,18 fields is correct , I ran it more than 100 times and after removing my LAST SORT CONDTION and it works fine. But this time finally I thought I should get the clarification from your all on how to use it .

When I remove the last sort condition on comp-3 filed i will get the proper result.

If you see carefully the Also 115,18 : till whatever position i have value i have given that and after that it has space to make it 18 BYTES. So trust me all the other sort conditions are correct the only problem is that COMP-3 SORT FIELD.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Apr 28, 2010 7:19 am
Reply with quote

Hi,

your original post did not have the additional spaces to make it 18 bytes,

have you tried selecting the PD field only ?

Gerry
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Wed Apr 28, 2010 7:30 am
Reply with quote

As CICS Guy mentioned, please post a record of the input......

Quote:
your original post did not have the additional spaces to make it 18 bytes,
Padded with leading blanks.....
Back to top
View user's profile Send private message
harry

New User


Joined: 27 Mar 2006
Posts: 31

PostPosted: Wed Apr 28, 2010 7:46 am
Reply with quote

Guys it seems it work, as MR. gcicchet, suggested that try without quotes: at that time it gave the MAXCC=0 and when I checked output file , it was having nothing . And I assumed that my input file is having the data , but that was the wrong understanding because I have deleted that input file in my first delete statement.

Just now I again tried the same thing , full input file comp-3 filed as

171,6,PD,EQ,520565) <<<ORD-NUMBER

It worked man,

BILLIONS OF THANKS .

[color=red]special thanks to CICS Guy, gcicchet, William Thompson . [/color]
icon_biggrin.gif icon_biggrin.gif

==============================================
Learning from this post :

Question : If we want to select some COMP-3 filed and give the value on the sort card what is the syntax for the same ?

Ans:

Ex if your comp-3 field has definition PIC S9(10)V USAGE COMP-3. and YOU KNOW THE VALUE IS

000255
00506C

Which is 520565 THEN this is how it should be coded.


171,6,PD,EQ,520565) <<<<<<<<comp-3 field.

WHERE 171- Starting position .
6--- length of PIC S9(10)V USAGE COMP-3

PD—FOR COMP-3 DATA TYPE

EQ- your selection criteria it can be LT,GT,LE, OR ANY OTHER POSSIBLE OPTION.

520565- THIS WAS THE VALUE WHICH I WAS TRYING TO SELECT .


===============================================
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Apr 28, 2010 8:05 am
Reply with quote

My, how wonderful that you have solve your problem, and colorful to boot....grin.....

Quote:
it seems it work, as MR. gcicchet, suggested that try without quotes
Congrats Gerry...... icon_lol.gif

Also should be "Learning from this post":
Quote:
By the way, just cur &paste and wrap in 'code' rather than 'quote'. And no bolding/underlining/color/font size is needed, we can find the needed info without that stuff........
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Apr 28, 2010 8:12 am
Reply with quote

Hi,

quote originated by CICS Guy

Quote:
Have you tried it without the quotes, such as 171,6,PD,EQ,+520565)?
so all KUDOS to CICS Guy icon_lol.gif icon_lol.gif


Gerry icon_redface.gif
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Apr 28, 2010 8:21 am
Reply with quote

All smiles, thanks Gerry....

Ain't this fun? icon_eek.gif icon_rolleyes.gif icon_lol.gif
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Apr 28, 2010 8:24 am
Reply with quote

Hi CICS Guy,

from Sydney Australia


Gerry
Back to top
View user's profile Send private message
harry

New User


Joined: 27 Mar 2006
Posts: 31

PostPosted: Wed Apr 28, 2010 8:27 am
Reply with quote

Hi,

Quote:
quote originated by CICS Guy


It was my mistake I should have looked into the input files correctly, just now i tried the first ans to this post


Quote:
Have you tried it without the quotes, such as 171,6,PD,EQ,+520565)?


and it has given the same results as 171,6,PD,EQ,520565). Just one question for my better understanding :

lets say this comp-3 field has some negative value then will i give (-) sign in the sort condition ?

e.g.
171,6,PD,EQ,-520565)? if i am selecting -520565 ?
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Apr 28, 2010 8:34 am
Reply with quote

Quote:
171,6,PD,EQ,-520565)? if i am selecting -520565 ?
Yup, you got it.
BTW, 520565 and +520565 are exactly the same in this application.
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 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 Interviewers are surprised with my an... Mainframe Interview Questions 6
No new posts Cobol COMP-2 fields getting scrambled... Java & MQSeries 6
No new posts convert alphanumeric PIC X(02) to hex... COBOL Programming 3
Search our Forums:

Back to Top