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
 

 

comvert packed decimal to decimal using sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Hima1985

New User


Joined: 17 Apr 2009
Posts: 70
Location: India

PostPosted: Thu Aug 18, 2011 12:34 am    Post subject: comvert packed decimal to decimal using sort
Reply with quote

Hi All

Can we convert packed decimal value to decimal value using sort? If yes can you please tell me how can I do it.

My requirement is,

I have a FB file of length 400 bytes.
1) First 30. Bytes is name
2) 31st to 35 bytes is key
3) 36th byte to 45th byte packed decimal amount value

I need to check the key value at 31st position and copy packed decimal value to 36th position if key value is 1130 and if key value is 1131 I need to copy packed decimal value to 46th position and if key value 1132 I need to copy packed decimal value to 55th position, depending on key value I need to copy the packed decimal value after converting it to decimal

Ex
Input
Code:

XYZXYZXYZ.                    113000@@@@@@
XYZXYZXYZ.                    113100@@@@@@
XYZXYZXYZ.                    113200@@@@@@
ABCABCXYZ.                   113000@@@@@@
ABCABCXYZ.                    113000@@@@@@
ABCABCXYZ.                    113100@@@@@@
ABCABCXYZ.                    113100@@@@@@


Output should be

Code:

XYZXYZXYZ.                    11300012345.30
XYZXYZXYZ.                    113100.                       12345.30                     
XYZXYZXYZ.                    113200.                                            12345.30
ABCABCXYZ.                   11300012345.30
ABCABCXYZ.                    11300012345.30
ABCABCXYZ.                    113100                       12345.30
ABCABCXYZ.                    113100                       12345.30

[/code]
Back to top
View user's profile Send private message

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Aug 18, 2011 1:08 am    Post subject: Reply to: comvert packed decimal to decimal using sort
Reply with quote

Hima1985 wrote:
3) 36th byte to 45th byte packed decimal amount value
I need to copy packed decimal value to 46th position and if key value 1132 I need to copy packed decimal value to 55th position, depending on key value I need to copy the packed decimal value after converting it to decimal


Hima 1985,

36-45 byte packed decimal field is 10 bytes. A readable format of that require at least 22 bytes ( 20 bytes of numeric 1 byte sign and 1 byte decimal point ). How are you planning to accommodate 22 bytes in 10 bytes?
Back to top
View user's profile Send private message
Hima1985

New User


Joined: 17 Apr 2009
Posts: 70
Location: India

PostPosted: Thu Aug 18, 2011 1:25 am    Post subject:
Reply with quote

Kolusu,

Thank You for the reply, its 10bytes PD means needs 22 bytes decimal. I was wrong in post, please provide me solution for this
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Aug 18, 2011 2:30 am    Post subject: Reply to: comvert packed decimal to decimal using sort
Reply with quote

Hima1985,

Use the following control cards.

Code:

//SYSIN    DD *                                                     
  SORT FIELDS=COPY                                                 
  OUTREC IFTHEN=(WHEN=(31,4,CH,EQ,C'1130'),                         
  OVERLAY=(36:36,10,PD,EDIT=(STTTTTTTTTTTTTTTTTTT.TT),SIGNS=(+,-))),
  IFTHEN=(WHEN=(31,4,CH,EQ,C'1131'),                               
  OVERLAY=(46:36,10,PD,EDIT=(STTTTTTTTTTTTTTTTTTT.TT),SIGNS=(+,-))),
  IFTHEN=(WHEN=(31,4,CH,EQ,C'1132'),                               
  OVERLAY=(55:36,10,PD,EDIT=(STTTTTTTTTTTTTTTTTTT.TT),SIGNS=(+,-)))
 
//*
Back to top
View user's profile Send private message
Hima1985

New User


Joined: 17 Apr 2009
Posts: 70
Location: India

PostPosted: Thu Aug 18, 2011 5:45 pm    Post subject:
Reply with quote

Kokusu,

Thank you, it worked. But one small problem ifthen. 1131 and 1132 its converting packed decimal to decimal and placing the value in 46th position and 55th position but, the packed decimal value at 35th position is remaining same there in output record.

I am getting output like this

Code:

XYZXYZXYZ.                    11300012345.30
XYZXYZXYZ.                    113100@@@@@.      12345.30                     
XYZXYZXYZ.                    113200.@@@@@                                            12345.30
ABCABCXYZ.                   11300012345.30
ABCABCXYZ.                    11300012345.30
ABCABCXYZ.                    113100@@@@@       12345.30
ABCABCXYZ.                    113100 @@@@@       12345.30      


I should not have packed decimal values in output.please sugget[/code]
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6967
Location: porcelain throne

PostPosted: Thu Aug 18, 2011 8:16 pm    Post subject:
Reply with quote

you can solve the problem of 36 not being spaced out for 1131 and 1132
by this:
Code:

IFTHEN=(WHEN=(31,4,CH,EQ,C'1131'),
OVERLAY=(46:36,10,PD,EDIT=(STTTTTTTTTTTTTTTTTTT.TT),SIGNS=(+,-),
         36:10X)),
IFTHEN=(WHEN=(31,4,CH,EQ,C'1132'),
OVERLAY=(55:36,10,PD,EDIT=(STTTTTTTTTTTTTTTTTTT.TT),SIGNS=(+,-),
         36:10X))


but there is no way your output is as you show it.
Kolusu's edit mask does not suppress leading zeros,
and your first ABCABCXYZ, the 1130 is left shifted one char.

learn to use the preview button.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Aug 18, 2011 10:11 pm    Post subject:
Reply with quote

Hima1985,

It is Kolusu and NOT Kokusu. The least you can do is spell the names of the people trying to help you.

You haven't explained that you need to space out the original PD field at 36. As DBZ mentioned you can use 36:10x after the edit mask.
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm


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