Page 1 of 1

convert CH to PD format

PostPosted: Thu Aug 09, 2012 12:11 pm
by Kiran Franics
Hi,

I need to convert a character field(Contains numeric data) to PD format.


input file declared as below:-

PREM(Position 28:44)     PIC -(13)9.99.
RATE(Position 47:53)     PIC -(3)9.99.



Input file have below record:-

----+----1----+----2----+----3----+----4----+----5---
***************************** Top of Data ***********
NH51418241IDBI014E 20200525            18.17YM   2.98
**************************** Bottom of Data *********


In the Sort card, I have mentioned as below:-

//SYSIN    DD *                               
 OPTION COPY                                   
 OUTREC OVERLAY=(28:28,14,SFF,TO=PD,LENGTH=14,
                 43:43,2,SFF,TO=PD,LENGTH=2)   
/*                                             


I got this output and it is not correct format.

NH51418241IDBI014E 20200525  a@YM  ð         
DCFFFFFFFFCCCCFFFC4FFFFFFFF00000000000000087ED0000028         
5851418241942901450202005250000000000000011F84000009F         



My expected output should be as below:-

NH51418241IDBI014E 20200525  a@YM  ð             
DCFFFFFFFFCCCCFFFC4FFFFFFFF00000087ED028
5851418241942901450202005250000011C8409C



Can you please help me solve this pblm?

Thanks

Re: convert CH to PD format

PostPosted: Thu Aug 09, 2012 12:39 pm
by BillyBoyo
A PD is much "smaller" than a character field. Try with TO=8 and 4.

Re: convert CH to PD format

PostPosted: Thu Aug 09, 2012 1:58 pm
by Kiran Franics
Thanks BillyBoyo, it is working as expected..

Re: convert CH to PD format

PostPosted: Thu Aug 09, 2012 2:44 pm
by BillyBoyo
Now that your post is Code'd, I'm wondering if you would be better off with BUILD for this situation, rather than OVERLAY. Your example shows the output record being shorter, which OVERLAY is not going to do. You also seem to have a binary field in between the two numerics, which isn't dealt with in your sort card.

Was this just an example extracted from something bigger? Are you OK with the whole thing now?

Re: convert CH to PD format

PostPosted: Fri Aug 17, 2012 1:19 pm
by Kiran Franics
Sorry BillyBoyo... Just now I saw ur post....

Above details are just an example and I need to convert huge data with so many fields.. Now I am doing the testing and everything looks fine.

Once again thanks for your help....

Re: convert CH to PD format

PostPosted: Fri Aug 17, 2012 1:50 pm
by BillyBoyo
Thanks for letting us know. If you have questions, there'll be someone here.

Re: convert CH to PD format

PostPosted: Fri Aug 17, 2012 7:57 pm
by dick scherrer
Hello,

If this is working as you want, great, but the "actual" output and the "expected" output posted are not consistent between the "characters" and the "hex".

At this point, it may not matter . . .

Re: convert CH to PD format

PostPosted: Sat Aug 18, 2012 1:24 pm
by BillyBoyo
Kiran, have a look at what Dick has said. You "sign" (the righ-most four bits of the packed-decimal field) is different from desired to achieved. This can be important, but might not matter at all. If you have lots of fields. best to get it sorted out early. Review format PD's "cousins".