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

How to convert decimal value from ZD to PD in sort


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

New User


Joined: 25 Sep 2009
Posts: 13
Location: chennai

PostPosted: Fri Jun 28, 2013 7:36 pm
Reply with quote

Hi All,

Please help me to resolve below syntax error.

The variable INIT-AMT is declared as PIC 9(03).9(06). When map the copybook in File-Aid the variable type is showing as 'ZE'. I want to convert this to packed decimal. My sort card is throwing syntax error.

Ex: Below is the copybook declaration.

Code:
02  ISIP-STD-RATE-TBL.                                 
    03  GK-ID                        PIC X(03).         
    03  EFF-DT                       PIC 9(08).         
    03  INIT-AMT                    PIC 9(03).9(06).   
    03  INIT-PEROD                PIC 9(05).         
    03  OVER-TIME-AMT          PIC 9(03).9(06).   
    03  OVER-TIME-PRD-SEC   PIC 9(05).         
    03  DUR-IND                     PIC X(01).         
    03  AMT-IND                     PIC X(01).         

Sort Syntax:

Code:
      SORT FIELDS=(1,3,CH,A,4,5,PD,A)             
      INREC FIELDS=(1,3,                         
                    4,8,ZD,TO=PD,LENGTH=5,       
                    12,10,ZE,TO=PD,LENGTH=5,     
                          *                       
                    22,5,ZD,TO=PD,LENGTH=3,       
                    27,10,ZE,TO=PD,LENGTH=5,     
                    37,5,ZD,TO=PD,LENGTH=3,       
                    42,2)
                       
WER268A  INREC STATEMENT   : SYNTAX ERROR         
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000     
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE     

Please help me to resolve this issue.

Thanks.!
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Jun 28, 2013 7:44 pm
Reply with quote

Quote:
12,10,ZE,TO=PD,LENGTH=5,
Is "ZE" a typo?
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Jun 28, 2013 7:46 pm
Reply with quote

Also, I've edited your post to add BBcode tags -- please learn to use them.
Back to top
View user's profile Send private message
latheef

New User


Joined: 25 Sep 2009
Posts: 13
Location: chennai

PostPosted: Fri Jun 28, 2013 7:56 pm
Reply with quote

Thanks Dhawan.

When i opened my copybook in File-Aid the variable INIT-AMT is showing as 'ZE' type. Since i used this type in my sort card. pls let me know if i need to use any other type instead of 'ZE' in my sort card.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Jun 28, 2013 8:06 pm
Reply with quote

File-Aid and DFOSRT are two different products and they don't talk to each other quite often, you know!

Try using UFF instead of ZE.

And you can call me Anuj -- I thought my name was quite easy, especially for Indians, however... icon_smile.gif
Back to top
View user's profile Send private message
latheef

New User


Joined: 25 Sep 2009
Posts: 13
Location: chennai

PostPosted: Fri Jun 28, 2013 8:10 pm
Reply with quote

When i opened this copy book with File-Aid, it is displaying as below.

Ref Field Name Picture Type Start End Length
**** Top of data ****
1 1 FILEMANAGER-DEFAULT-01 AN 1 43 43
2 2 ISIP-STD-RATE-TBL AN 1 43 43
3 3 GK-ID X(03) AN 1 3 3
4 3 EFF-DT 9(08) ZD 4 11 8
5 3 INIT-AMT 9(03).9(06) ZE 12 21 10
6 3 INIT-PEROD 9(05) ZD 22 26 5
7 3 OVER-TIME-AMT 9(03).9(06) ZE 27 36 10
8 3 OVER-TIME-PRD-SEC 9(05) ZD 37 41 5
9 3 DUR-IND X(01) AN 42 42 1
10 3 AMT-IND X(01) AN 43 43 1
**** End of data ****
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Jun 28, 2013 8:11 pm
Reply with quote

Please learn to use BBcode Tags.

Also try using UFF instead of ZE, as I said earlier.
Back to top
View user's profile Send private message
latheef

New User


Joined: 25 Sep 2009
Posts: 13
Location: chennai

PostPosted: Fri Jun 28, 2013 9:06 pm
Reply with quote

Thanks anuj...it is working fine, but data population is showing wrong for below scenario..

for 123.123456 it is populating in output as excepted in the same format.
for 123.123 it is populating as 0.123123.

as mentioned above the variable declaration is 9(3).9(6)... please help to resolve the issue
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


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

PostPosted: Fri Jun 28, 2013 9:23 pm
Reply with quote

If the variable definition is 9(3).9(6), the data would have to be 123.123000 to conform to it, no? Do you have bad data or a bad copybook?
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Jun 28, 2013 11:37 pm
Reply with quote

latheef wrote:
Thanks anuj...it is working fine, but data population is showing wrong for below scenario..
To err is human - and to blame it on a computer is even more so... icon_smile.gif

Are you sure the input has 123.123, as Sir John has pointed out?
Back to top
View user's profile Send private message
latheef

New User


Joined: 25 Sep 2009
Posts: 13
Location: chennai

PostPosted: Sat Jun 29, 2013 9:18 am
Reply with quote

Yes, The varibale declaration is PIC 9(3).9(6). Some times we are receiving data like 123.123. our requirement is to load this data in a DB2 table. After sorting we are loading the data in to this table. It is loading in to table as 0.123123 whenever the input record having data like 123.123. Please help me to resolve the issue. Thanks.
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: Sat Jun 29, 2013 1:38 pm
Reply with quote

latheef wrote:
Yes, The varibale declaration is PIC 9(3).9(6). Some times we are receiving data like 123.123. our requirement is to load this data in a DB2 table. After sorting we are loading the data in to this table. It is loading in to table as 0.123123 whenever the input record having data like 123.123. Please help me to resolve the issue. Thanks.


In PIC 9(3).9(6), your values will look like this:
Code:

123.123000
000.123123


And the code that has been suggested to you would work.

You don't get those values, so, although it is coded s PIC 9(3).9(6), that is not reflecting the contents of the field. It may as well be PIC X(10), as there is no PICture which represents a floating decimal-point.

That aside, it just means you need to do a little more to get your data. The easiest way to deal with it is probably with PARSE, but what you really need to do is to look at and extract from the data all the possible arrangements of the actual data (forget the PICture clause, look at the data).

What does zero look like? What does a number with no integer part look like? A number with no decimal part? Some decimal part, but fewer than six? Can you get an integer part with more than three digits? Everything.

You'll need that to work out how to treat it, and you'll need that if you still require assistance (and you'll need it in the Code tags, to preserve alignment.
Back to top
View user's profile Send private message
latheef

New User


Joined: 25 Sep 2009
Posts: 13
Location: chennai

PostPosted: Sun Jun 30, 2013 9:34 am
Reply with quote

Thanks Bill Woodger. Iwill try by using PARSE and let you know further updates.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Sun Jun 30, 2013 11:23 am
Reply with quote

Quote:
What does zero look like? What does a number with no integer part look like? A number with no decimal part? Some decimal part, but fewer than six? Can you get an integer part with more than three digits?
latheef,

Do you mind answering the above? Along with that, Does your decimal point appear in the same position? If it is, you may not need a PARSE, probably a FINDREP from ' ' to '0' will do. It all depends on how your data will look like.
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 Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Need to convert date format DFSORT/ICETOOL 20
Search our Forums:

Back to Top