Portal | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
latheef

New User

Joined: 25 Sep 2009
Posts: 13
Location: chennai

Posted: Fri Jun 28, 2013 7:36 pm    Post subject: How to convert decimal value from ZD to PD in sort

Hi All,

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

Thanks.!

Anuj Dhawan

Senior Member

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

Posted: Fri Jun 28, 2013 7:44 pm    Post subject:

 Quote: 12,10,ZE,TO=PD,LENGTH=5,
Is "ZE" a typo?
Anuj Dhawan

Senior Member

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

 Posted: Fri Jun 28, 2013 7:46 pm    Post subject: Also, I've edited your post to add BBcode tags -- please learn to use them.
latheef

New User

Joined: 25 Sep 2009
Posts: 13
Location: chennai

 Posted: Fri Jun 28, 2013 7:56 pm    Post subject: Reply to: How to convert decimal value from ZD to PD in sort 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.
Anuj Dhawan

Senior Member

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

 Posted: Fri Jun 28, 2013 8:06 pm    Post subject: 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...
latheef

New User

Joined: 25 Sep 2009
Posts: 13
Location: chennai

 Posted: Fri Jun 28, 2013 8:10 pm    Post subject: Reply to: How to convert decimal value from ZD to PD in sort 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 ****
Anuj Dhawan

Senior Member

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

 Posted: Fri Jun 28, 2013 8:11 pm    Post subject: Please learn to use BBcode Tags. Also try using UFF instead of ZE, as I said earlier.
latheef

New User

Joined: 25 Sep 2009
Posts: 13
Location: chennai

 Posted: Fri Jun 28, 2013 9:06 pm    Post subject: Reply to: How to convert decimal value from ZD to PD in sort 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
Akatsukami

Global Moderator

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

 Posted: Fri Jun 28, 2013 9:23 pm    Post subject: 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?
Anuj Dhawan

Senior Member

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

Posted: Fri Jun 28, 2013 11:37 pm    Post subject: Re: Reply to: How to convert decimal value from ZD to PD in

 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...

Are you sure the input has 123.123, as Sir John has pointed out?
latheef

New User

Joined: 25 Sep 2009
Posts: 13
Location: chennai

 Posted: Sat Jun 29, 2013 9:18 am    Post subject: Reply to: How to convert decimal value from ZD to PD in sort 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.
Bill Woodger

Moderator Emeritus

Joined: 09 Mar 2011
Posts: 7312
Location: Inside the Matrix

Posted: Sat Jun 29, 2013 1:38 pm    Post subject: Re: Reply to: How to convert decimal value from ZD to PD in

 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.
latheef

New User

Joined: 25 Sep 2009
Posts: 13
Location: chennai

 Posted: Sun Jun 30, 2013 9:34 am    Post subject: Reply to: How to convert decimal value from ZD to PD in sort Thanks Bill Woodger. Iwill try by using PARSE and let you know further updates.
Arun Raj

Moderator

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

Posted: Sun Jun 30, 2013 11:23 am    Post subject:

 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.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Parsing more than 1000 columns in a s... ssuthagar SYNCSORT 10 Tue Sep 22, 2020 12:23 am SORT the records based on the second ... Ramsee SYNCSORT 1 Wed Aug 19, 2020 3:01 pm Required Date Format in Include Sort ... vivky_vivek DFSORT/ICETOOL 6 Fri Aug 14, 2020 6:52 am To convert numeric to Packed Decimal vinu78 DFSORT/ICETOOL 9 Fri Jul 31, 2020 7:14 pm Problem while trying to manipulate re... amitc23 DFSORT/ICETOOL 3 Tue Jun 30, 2020 1:19 pm

 © 2003-2020 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us