MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Supress zero & Convert Editing field to Assumd decimal p
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
sabarisavi
Beginner


Joined: 25 Apr 2008
Posts: 30
Topics: 6
Location: Ashburn, VA

PostPosted: Fri May 16, 2008 7:39 am    Post subject: Supress zero & Convert Editing field to Assumd decimal p Reply with quote

Hi,

Sorry, if already this problem is resolved by Forums. Here the problem is,

I want to filter the Editing numeric filed to implicit numeric form. We got the pricing records thru Excel Spreadsheet, FTP transfer these records to Mainframe dataset. Problem is, when the customer sends the fields by preceding and succeeding zeros, our program is treat as new pricing. Say eg:
Code:

Name   Price        ZIP
XXXX   0012.10   20087
AAAA   0123.20   20900
KKKK   0007.70   21244

Our program will not treat the price 12.10 is same as 0012.10, mean it will not suppress the prefix and suffix zeros after the decimal point.

Our goal is, convert the 0012.10 to a numeric field 9999.99 (Implicit decimal ie., S9(4)v99). For our computing purpose. I read we can do sort, Please help me, i'm new to mainframe field.
Back to top
View user's profile Send private message
CraigG
Intermediate


Joined: 02 May 2007
Posts: 202
Topics: 0
Location: Viginia, USA

PostPosted: Fri May 16, 2008 7:57 am    Post subject: Reply with quote

What language is your program written in that is doing this compare? I think you have a serious programming error.
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Fri May 16, 2008 8:20 am    Post subject: Reply with quote

This probably should be in the Programming section or Utilities section but certainly not the JCL section.

All the same - what are your field definitions for this data. It looks as though you may be using a character field rather than a numeric field. If you want an assumed decimal point and the input has a real decimal point then you need to read it into an edited numeric field then move it to an unedited numeric field.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
sabarisavi
Beginner


Joined: 25 Apr 2008
Posts: 30
Topics: 6
Location: Ashburn, VA

PostPosted: Fri May 16, 2008 9:33 am    Post subject: Reply with quote

Thanks, i suppose to post this conversation in the utilities Page. Well.

Our JOB flow is FTP send the dataset to EZTRIVE job to compare the price. But this EZT, have problem with comparing the 12.10 and new pricing 0012.10. Since both are same, but our EZT step treat as differnt records.

This point we dont want to change the EZTRIVE Program, instead write a sort, utility - reformat logic to supress the preceding and succeeding zeros in the price field.

for Instance, 00012.990 will become 12.99.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri May 16, 2008 9:56 am    Post subject: Reply with quote

sabarisavi,

Your posts are quite confusing. I am not sure what you are trying to do. However I am guessing that the excel file is ftp'd with tab delimiter and the postion of the numeric field varies . If that is the case then we need to use PARSE function to edit the numeric fields. Let us know and we will show you an example as to how to do it

Just show us how the input file Mainframe looks like
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sabarisavi
Beginner


Joined: 25 Apr 2008
Posts: 30
Topics: 6
Location: Ashburn, VA

PostPosted: Fri May 16, 2008 11:31 am    Post subject: Reply with quote

Great, thanks Kolusu. Sorry for that if my statements are really confused. Well.

My Input file are below (Key field is - Unit Dosage is 11 Byte alphanumeric)
Code:

Name   Unit Dosage        ZIP
XXXX   0012.10            20087
AAAA   01232.0            20900
KKKK   0007.70            21244


I want to change like below (Output file). New Unit Dosage will be 9(7).999 = 11byte
Code:

Name   Unit Dosage     ZIP
XXXX   0000012.100     20087
AAAA   0001232.000     20900
KKKK   0000007.700     21244

Note: I just want to convert the Unit Dosage to a standard format of 9(7).999 from 11 byte format.
Back to top
View user's profile Send private message
CraigG
Intermediate


Joined: 02 May 2007
Posts: 202
Topics: 0
Location: Viginia, USA

PostPosted: Fri May 16, 2008 11:47 am    Post subject: Reply with quote

In your input file unit dosage appears to be a 7 byte alphanumeric field not 11. And you are not supressing the leading or trailing zeros but adding them. That may be what is confusing people.
Back to top
View user's profile Send private message
sabarisavi
Beginner


Joined: 25 Apr 2008
Posts: 30
Topics: 6
Location: Ashburn, VA

PostPosted: Fri May 16, 2008 12:26 pm    Post subject: Reply with quote

Well,

Intially we thought to supress but future reference we have to keep leading and trailing zeros.

From my Input, Since text file made up with balnks. so FTP retreive the same.
It is sure, Unit Dosage is a 11 byte made up with blank spaces, it is not 7 byte. Here it shows bytes 7 but with preceeding and trailing blank ( spaces).

Let me know, if still i'm confussed.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri May 16, 2008 12:44 pm    Post subject: Reply with quote

sabarisavi,

The following DFSORT JCL will give you desired results. I assumed that your input is FB recfm and 80 bytes LRECL

Code:

//STEP0100 EXEC PGM=ICEMAN                           
//SYSOUT   DD SYSOUT=*                               
//SORTIN   DD *                                       
----+----1----+----2----+----3----+----4----+----5----
XXXX   0012.10            20087                       
AAAA   01232.0            20900                       
KKKK   0007.70            21244                       
//SORTOUT  DD SYSOUT=*                               
//SYSIN    DD *                                       
  SORT FIELDS=COPY                                   
  INREC PARSE=(%00=(ABSPOS=8,ENDBEFR=C'.',FIXLEN=07),
               %01=(FIXLEN=3)),                       
         BUILD=(1,7,%00,UFF,M11,LENGTH=7,C'.',       
                %01,UFF,M11,LENGTH=3,19,62)           
/*


The output from this job is

Code:

XXXX   0000012.010        20087   
AAAA   0001232.000        20900   
KKKK   0000007.070        21244   


Hope this helps...

Cheers
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sabarisavi
Beginner


Joined: 25 Apr 2008
Posts: 30
Topics: 6
Location: Ashburn, VA

PostPosted: Fri May 16, 2008 1:33 pm    Post subject: Reply with quote

Great Kolusu, you always prove that you are a Mainframe Encyclopedia. Thank you again.

It would be helpfull to every one that if you could you please brief us this
SYSIN CARD- Parse, UFF, M11 and %00 ie., simply this logic.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri May 16, 2008 3:09 pm    Post subject: Reply with quote

sabarisavi,

Check this link which explains in detail about PARSE with examples

http://www-304.ibm.com/systems/support/storage/software/sort/mvs/peug/pdf/sortpeug.pdf

The first %00 operates starts scanning the input record from position 8 in the input file and it stops when it encounters the decimal dot , and the next %01 grabs the 3 bytes after the decimal dot

Check this link which explains in detail about UFF and SFF

http://www-304.ibm.com/systems/support/storage/software/sort/mvs/pdug/pdf/sortpdug.pdf

M11 is just an edit mask which makes the field to have leading zeroes. Here are the different edit masks available with DFSORT.

M11 Edit mask


Hope this helps...
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sabarisavi
Beginner


Joined: 25 Apr 2008
Posts: 30
Topics: 6
Location: Ashburn, VA

PostPosted: Fri May 16, 2008 4:18 pm    Post subject: Reply with quote

Thanks again, Well. Here, we had a simple problem, yet to resolve by our selves. Looking for your help.

First record in the Input file

XXXX 0012.10 20087


Current output file is

XXXX 0000012.010 20087

The Unit Dosage should not 0000012.010 instead it would be 0000012.100.

The Actual Output would be

XXXX 0000012.100 20087
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri May 16, 2008 4:32 pm    Post subject: Reply with quote

sabarisavi,

That is a weird way of representing the decimals. why would '10 ' considered as 100 ?. He already gave a zero why not give the other zero also ? Anyway change your control cards to the following and it will give you the desired results. We basically use ALTSEQ to convert any spaces to '0' for decimals

Code:

//SYSIN    DD *                                         
  SORT FIELDS=COPY                                     
  INREC PARSE=(%00=(ABSPOS=8,ENDBEFR=C'.',FIXLEN=07),   
               %01=(FIXLEN=3)),                         
         BUILD=(1,7,%00,UFF,M11,LENGTH=7,C'.',         
                %01,TRAN=ALTSEQ,19,62)                 
  ALTSEQ CODE=(40F0)                                   
/*                                                     


Hope this helps...

Cheers
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sabarisavi
Beginner


Joined: 25 Apr 2008
Posts: 30
Topics: 6
Location: Ashburn, VA

PostPosted: Fri May 16, 2008 5:01 pm    Post subject: Reply with quote

Thanks. It is working fine. I hope, there is some miscommunication some where. Well,

FYI - We expect the output becomes .100 not for .010 thats what i meant, after decimal if any zero come followed by any number, the value is different rather than zero preceed the decimal point.

How ever, your new approch is working fine, but i dont know what is wrong with the old approch, ie.,
Code:

//SYSIN    DD *                                       
  SORT FIELDS=COPY                                   
  INREC PARSE=(%00=(ABSPOS=8,ENDBEFR=C'.',FIXLEN=07),
               %01=(FIXLEN=3)),                       
         BUILD=(1,7,%00,UFF,M11,LENGTH=7,C'.',       
                %01,UFF,M11,LENGTH=3,19,62)           
/*


Eventually, every one are appriciating your service. Keep it up. Hope, i cleared my requirement.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri May 16, 2008 6:24 pm    Post subject: Reply with quote

sabarisavi wrote:
your new approch is working fine, but i dont know what is wrong with the old approch,


sabarisavi,

The old approach is considering the the field after dot as UFF (unsigned free form numeric) which would extract decimal digits (0-9) from right to left anywhere in the field to form a positive number. Any combination of characters is valid, but characters other than 0-9 are ignored.

So the spaces are ignored and hence 10 followed by a space is treated as just 10. The new approach is using ALTSEQ to replace spaces with zero. So a 10 followed by space is changed to 100. The last zero is from TRAN function which converted the space to zero.

Hope this helps...

Cheers
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group