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
 

 

syncsort outrec and numeric to comp.

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

Active User


Joined: 17 May 2010
Posts: 175
Location: India

PostPosted: Mon Apr 09, 2012 9:27 pm    Post subject: syncsort outrec and numeric to comp.
Reply with quote

Hi,

I have a variable with pic s9(9) comp.
example,
01 var1 pic s9(9) comp.
can we store a 10 digit numeric number in var1? if yes, how?

Let us say i have a number 1234567890. how do i copy it using syncsort?
from what i know, i have to user outrec. but am not able to find the exact sort card.

Outrec=(1:1,10,??)

Please let me know if the explanatin is not clear.
Back to top
View user's profile Send private message

saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Mon Apr 09, 2012 9:48 pm    Post subject:
Reply with quote

Hi Shan,

Integer value will be stored in hexa decimal format in the file.
Code:

//STEP01  EXEC PGM=SORT                                             
//SYSPRINT  DD SYSOUT=*                                             
//SYSOUT    DD SYSOUT=*                                             
//SORTIN    DD *                                                   
1234567890                                                         
/*                                                                 
//SORTOUT   DD SYSOUT=*                                             
//SYSIN  DD  *                                                     
 SORT FIELDS=COPY                                                   
 OUTREC FIELDS=(1:1,10,11:1,10,ZD,TO=BI,LENGTH=4,80:X)             
/* 


Position 1 to 10 will have zoned decimal value and position 11 to 14 will have integer value

Output:

Code:
----+----1----
1234567890ño K
FFFFFFFFFF490D
12345678909622
Back to top
View user's profile Send private message
shankarm

Active User


Joined: 17 May 2010
Posts: 175
Location: India

PostPosted: Mon Apr 09, 2012 11:35 pm    Post subject:
Reply with quote

Thanks a lot for the response saiprasadh.
This allows a maximum of 4294967295 only correct instead of 1234567890 if i give 9087654321 as input the job will fail correct?

Do you know of any other way to store this?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Mon Apr 09, 2012 11:40 pm    Post subject: Reply to: syncsort outrec and numeric to comp.
Reply with quote

You are correct in the maximum value for 10 is as you state, for unsigned.

This is represented by X'FFFFFFFF'. So, no, without more space, you can't store more. You are "maxed out" for four bytes.

What is your actual problem? What are the upper and lower limits of your range? Why can't you use more space?
Back to top
View user's profile Send private message
shankarm

Active User


Joined: 17 May 2010
Posts: 175
Location: India

PostPosted: Mon Apr 09, 2012 11:46 pm    Post subject:
Reply with quote

Bill,

A very big process in production seem to use s9(9) comp and it writes a value 7000000000, i knew this is not technically possible but still the process is giving this value.

am analyzing the process to resolve an issue, so i wanted to know if there is some other way to store 10 digits..
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Apr 09, 2012 11:54 pm    Post subject:
Reply with quote

Hello,

What is in the binary field after the 7000000000 is placed in the field? Show this value in hex.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Mon Apr 09, 2012 11:54 pm    Post subject: Reply to: syncsort outrec and numeric to comp.
Reply with quote

OK. That's why I asked about the range.

What is the smallest value that actually exists in the data at the moment? As a short-term, if the minimum is large enough, you can adjust by subtracting it from everything.

Otherwise, if the minimum is not big enough, you are into byte/bit-stealing as a short-term work-around.
Back to top
View user's profile Send private message
shankarm

Active User


Joined: 17 May 2010
Posts: 175
Location: India

PostPosted: Tue Apr 10, 2012 12:04 am    Post subject:
Reply with quote

the next field is another s9(9) comp followed by filler(just spaces). The value of both the fields are mentioned below,
7787017030
7246579018

The above mentioned values are DBKEYS in an IDMS databbase.

The range can be anything starting from 1900000000 to 8999999999.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Tue Apr 10, 2012 12:25 am    Post subject: Reply to: syncsort outrec and numeric to comp.
Reply with quote

OK, the range is too big to get into four bytes.

Your best bet might be the filler. If you have filler, you don't have to scrimp on bits, you can go for a whole byte or two bytes for Cobol convenience.

Basically you'd use the new as an "overflow" area.

I'd do a module, called by anything which needs to access the field, all access to the field through the module. Called with original, new from filler, and the value which is intended for the original field (or whatever function is required).
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


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

PostPosted: Tue Apr 10, 2012 12:39 am    Post subject:
Reply with quote

shankarm wrote:
the next field is another s9(9) comp followed by filler(just spaces). The value of both the fields are mentioned below,
7787017030
7246579018

The above mentioned values are DBKEYS in an IDMS databbase.

The range can be anything starting from 1900000000 to 8999999999.

Whilst I do not know IDMS, does this not imply that the keys are stored somewhere, in the main data base or a secondary index? If so, in what form are they stored -- doubleword binary, packed decimal, zoned decimal?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Tue Apr 10, 2012 1:50 am    Post subject:
Reply with quote

Quote:
A very big process in production seem to use s9(9) comp and it writes a value 7000000000, i knew this is not technically possible but still the process is giving this value.


Sorry, I didn't read the second part of the sentence.

If you have something that is showing you 10 digits already, then the comp pic s9(9) is not the source of the number. At least not directly.

Either the "fix" is already in in some way, or the source is the database internals, as has been suggested now.

Noticing now, you even have a signed field (in your post at least). That halves the maximum value. Even then you have to have the right compile option.

The field you are looking at is not the source of a 10-digit number > 2-whatever (half the 4-whatever from above).
Back to top
View user's profile Send private message
shankarm

Active User


Joined: 17 May 2010
Posts: 175
Location: India

PostPosted: Wed Apr 11, 2012 7:28 am    Post subject:
Reply with quote

sorry everone for wasting your time. as we discussed, s9(9) cannot store 7000000000 and more, we have an program that handles it. takes the dbkeys and multiply it with 256. and there is a calculation logic for DBKEY.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Apr 11, 2012 7:38 pm    Post subject: Reply to: syncsort outrec and numeric to comp.
Reply with quote

Thank you for letting us know it is resolved icon_smile.gif

d
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 syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts Syncsort - NULL in Integer field chec... nartcr SYNCSORT 4 Thu Oct 06, 2016 6:47 am


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