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 Previous  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: Sun May 18, 2008 7:21 am    Post subject: Reply with quote

Thanks Kolusu.
Back to top
View user's profile Send private message
tt_sav
Beginner


Joined: 22 Dec 2006
Posts: 2
Topics: 0

PostPosted: Sun May 18, 2008 8:01 am    Post subject: Reply with quote

Hi,

It is really interesting discussion and have a small clarification. When i change the Input file and the byte location, i didnt get your expected result, Please clarify.

Consider my Input file is 133 byte LRECL and the conversion numeric field starts at 15 th byte.

Input file is :-
Code:

=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----
****** ***************************** Top of Data **********************
000100 aaaaaarrrrrrrr89990.99       34344                           
000200 XXXX             89.10            20087                           
000300 AAAA 89        53200            20900                           
000400 AAAA             45.100          20900                           

I have changed the code as below,
Code:

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


Output file is :-
Code:

********************************* TOP OF DATA *************
aaaaaarrrrrrrr0089990.9900.99         34344               
XXXX          0000089.1000            20087               
AAAA 89       0053200.0000            20900               
AAAA          0000045.10000           20900               
******************************** BOTTOM OF DATA ***********

I think, it looks like my understading of the byte positions are wrong.

Thanks,
Swathi
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: Sun May 18, 2008 1:02 pm    Post subject: Reply with quote

tt_sav,

You changed the pos of the numeric field but you forgot to change the position of the other fields following the numeric field. In my example I assumed the rest of the fields start at pos 19 and the input file length is 80.

Change your input to the following. Pay attention to the contents in bold.

Quote:

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

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


Joined: 22 Dec 2006
Posts: 2
Topics: 0

PostPosted: Sun May 18, 2008 2:37 pm    Post subject: Reply with quote

Great Kolusu, it is working fine. I really appriciate your "workaholic", eventhough in weekend. Thanks to everyone in part of the discussion, to know this logic.
Back to top
View user's profile Send private message
sabarisavi
Beginner


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

PostPosted: Sun May 18, 2008 8:43 pm    Post subject: Reply with quote

Hi Kolusu,

My apologies for making this discussion to long, how ever it is very useful for me and everyone. Well, we are facing difficulties with this new input file.

Input LRECL = 128 and 11 byte conversion field starts at 11 th byte and also have other numeric field in this file, apart from the 11th byte field.

Input file is below,
Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data ************************
00780.NO .00000000003.02/01/2008.12/31/9999.0000000000.04784....................
00780.NO .00000000010.02/01/2008.12/31/9999.0000000000.04784....................
00780.NO .00000000014.02/01/2008.12/31/9999.0000000000.04784....................
00780.NO .00000000015.02/01/2008.12/31/9999.0000000000.04784....................
00780.NO .00000000020.02/01/2008.12/31/9999.0000000000.04784....................
00780.NO .00000000021.02/01/2008.12/31/9999.0000000000.04784....................

My code is below,
Code:

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


But, the output is different. It takes the next numeric field
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: Mon May 19, 2008 10:09 am    Post subject: Reply with quote

sabarisavi,

The sample data you have shown ,the numeric field at pos 11 does NOT have a decimal point. How do you plan to make it as decimal field?

All of them have whole numbers

Code:

00000000003
00000000010
00000000014
00000000015
00000000020
00000000021


What do you expect the output to be for these numbers?

Kolusu
_________________
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: Mon May 19, 2008 10:52 am    Post subject: Reply with quote

Thanks. Well, Some of the records are in the Position 11 have decimal point and most of them have whole number, since we stictly concentrate at Poision 11 with 11 byte field.

Since, i already tested with whole number and decimal numbers as well. The output, we expect
if whole numbers, it will take numeric field along with 3 digit fractional number.
if any decimal numbers, it will format it with 7 digit whole no. and decimal
point with 3 digit fraction number ie., 9(7).9(3).

Kolusu, Hope i cleared, please help me to resolve this problem.
Back to top
View user's profile Send private message
sabarisavi
Beginner


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

PostPosted: Mon May 19, 2008 11:00 am    Post subject: Reply with quote

For example:
If Input file is like below
Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data ************************
00780.NO .00000000003.02/01/2008.12/31/9999.0000000000.04784....................
00780.NO .      88.10.02/01/2008.12/31/9999.0000000000.04784....................
00780.NO .0000056.014.02/01/2008.12/31/9999.0000000000.04784....................
00780.NO .0000330.015.02/01/2008.12/31/9999.0000000000.04784....................
00780.NO .00000000020.02/01/2008.12/31/9999.0000000000.04784....................
00780.NO .00000000021.02/01/2008.12/31/9999.0000000000.04784....................

We expect the Output should be:-
Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data ************************
00780.NO .0000003.000.02/01/2008.12/31/9999.0000000000.04784....................
00780.NO .0000088.100.02/01/2008.12/31/9999.0000000000.04784....................
00780.NO .0000056.014.02/01/2008.12/31/9999.0000000000.04784....................
00780.NO .0000330.015.02/01/2008.12/31/9999.0000000000.04784....................
00780.NO .0000020.000.02/01/2008.12/31/9999.0000000000.04784....................
00780.NO .0000021.000.02/01/2008.12/31/9999.0000000000.04784....................
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: Mon May 19, 2008 12:20 pm    Post subject: Reply with quote

sabarisavi,

use the following control cards which will give you the desired results

Code:

//SYSIN    DD *                                             
  SORT FIELDS=COPY                                         
  INREC IFTHEN=(WHEN=(11,11,SS,EQ,C'.'),                   
        PARSE=(%00=(ABSPOS=11,ENDBEFR=C'.',FIXLEN=11),     
               %01=(FIXLEN=3)),                             
         BUILD=(1,10,%00,UFF,M11,LENGTH=7,C'.',             
                %01,TRAN=ALTSEQ,22,107)),                   
        IFTHEN=(WHEN=NONE,                                 
         BUILD=(1,10,11,11,ZD,M11,LENGTH=7,C'.000',22,107)) 
        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: Mon May 19, 2008 2:11 pm    Post subject: Reply with quote

Thank you Kolusu.
Back to top
View user's profile Send private message
sabarisavi
Beginner


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

PostPosted: Thu Jul 03, 2008 2:41 pm    Post subject: Reply with quote

Hi Kolusu,

We got an issue, when we use 2.5 or 1.2 in the 20th byte position. it will convert 2.5.0 and 1.2.0. Please help me how resolve.

My Input file is
Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
41620.NO .00000000300.06/28/2008.12/31/9999.00000000000.2579....................
42235.YES.000000002.5.06/28/2008.12/31/9999.0000000000.05806....................
43691.NO .000000001.2.06/28/2008.12/31/9999.0000000002.56975....................

Output file is
Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
41620.NO .0000300.000.06/28/2008.12/31/9999.00000000000.2579....................
42235.YES.0000002.5.0.06/28/2008.12/31/9999.0000000000.05806....................
43691.NO .0000001.2.0.06/28/2008.12/31/9999.0000000002.56975....................


My Sysin is
Code:

SORT FIELDS=COPY                                                   
INREC IFTHEN=(WHEN=(11,11,SS,EQ,C'.'),                             
      PARSE=(%00=(ABSPOS=11,ENDBEFR=C'.',FIXLEN=11),               
             %01=(FIXLEN=3)),                                       
       BUILD=(1,10,%00,UFF,M11,LENGTH=7,C'.',                       
              %01,TRAN=ALTSEQ,22,107)),                             
      IFTHEN=(WHEN=NONE,                                           
       BUILD=(1,10,11,11,ZD,M11,LENGTH=7,C'.000',22,107))           
      ALTSEQ CODE=(40F0)                                           

Please help me how to resolve the 2 periods in the positions 11 to 11 byte field.

Our expected output is
Code:

=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
000578 41620 NO  0000300.500 06/28/2008 12/31/9999 00000000000.2579           
000579 42235 YES 0000002.500 06/28/2008 12/31/9999 0000000000.05806           
000580 43691 NO  0000001.200 06/28/2008 12/31/9999 0000000002.56975
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: Thu Jul 03, 2008 3:17 pm    Post subject: Reply with quote

sabarisavi,

The output you show has a few problems. How did you get 0000300.500 on the first record? It doesn't have any decimal positions on the record. How did you end up with .500?

Also the last numeric field you show 5 decimals on the 2 and 3 records but on the 1st record you only 4 decimals.

What are the rules governing the decimals?

Assuming that they are typos , here is a DFSORT JCL which will give the desired results

Code:

//STEP0100 EXEC PGM=ICEMAN                                         
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                   
41620.NO .00000000300.06/28/2008.12/31/9999.00000000000.2579       
42235.YES.000000002.5.06/28/2008.12/31/9999.0000000000.05806       
43691.NO .000000001.2.06/28/2008.12/31/9999.0000000002.56975       
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                   
  SORT FIELDS=COPY                                                 
  INREC IFTHEN=(WHEN=(11,11,SS,EQ,C'.'),                           
        PARSE=(%00=(ABSPOS=11,ENDBEFR=C'.',FIXLEN=10),             
               %01=(ENDBEFR=C'.',FIXLEN=3)),                       
       OVERLAY=(81:%00,UFF,M11,LENGTH=7,C'.',                     
               %01,JFY=(SHIFT=LEFT)),HIT=NEXT),                   
        IFTHEN=(WHEN=(11,11,SS,NE,C'.'),                           
       OVERLAY=(81:11,11,ZD,M11,LENGTH=7,C'.000'),HIT=NEXT),       
        IFTHEN=(WHEN=(45,16,SS,EQ,C'.'),                           
        PARSE=(%02=(ABSPOS=45,ENDBEFR=C'.',FIXLEN=10),             
               %03=(ENDBEFR=C'.',FIXLEN=5)),                       
       OVERLAY=(92:%02,UFF,M11,LENGTH=10,C'.',                     
               %03,JFY=(SHIFT=LEFT)),HIT=NEXT),                   
        IFTHEN=(WHEN=(45,16,SS,NE,C'.'),                           
       OVERLAY=(92:45,16,ZD,M11,LENGTH=10,C'.00000'))             
                                                                   
  OUTREC BUILD=(1,10,81,11,TRAN=ALTSEQ,22,23,92,16,TRAN=ALTSEQ)   
  ALTSEQ CODE=(40F0)                                               
/*                                                                 


The output from this job is
Code:

41620.NO .0000300.000.06/28/2008.12/31/9999.0000000000.25790
42235.YES.0000002.500.06/28/2008.12/31/9999.0000000000.05806
43691.NO .0000001.200.06/28/2008.12/31/9999.0000000002.56975


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: Thu Jul 03, 2008 5:22 pm    Post subject: Reply with quote

Thanks Kolusu,

FYI - The decimal values are not amount / pricing information , they are the drug dosages, since, the drug values /drug density are differ for each fractions. that is 0.2570 differ 0.25. So, the inputs are correct and it s not a typo.
Back to top
View user's profile Send private message
sabarisavi
Beginner


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

PostPosted: Thu Jul 03, 2008 5:55 pm    Post subject: Reply with quote

Kolusu - The suggested code, is changed the last numeric field, we want to format the 11 byte field only not all the numeric field.

I will recap my requirement here:
Input file LRECL = 128 and the Output file also the same. We have to change only the 11th byte of X(11) will format to 9(7).9(3).

We want to change the 11 byte alphanumeric field to 9(7).9(3) format which the position starts at 11th byte. The X(11) byte Unit dosage field may have any decimal field or whole number or any zeros.


For example,

Input
Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data ************************
00780.NO .000000003.5.02/01/2008.12/31/9999.0000000000.04784....................
00780.NO .      88.10.02/01/2008.12/31/9999.0000000000.04784....................
00780.NO .0000056.014.02/01/2008.12/31/9999.0000000000.04784....................
00780.NO .0000330.015.02/01/2008.12/31/9999.0000000000.04784....................
00780.NO .00000000020.02/01/2008.12/31/9999.0000000000.04784....................
00780.NO .0000000.002.02/01/2008.12/31/9999.0000000000.04784....................

Expected Output
Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data ************************
00780.NO .0000003.500.02/01/2008.12/31/9999.0000000000.04784....................
00780.NO .0000088.100.02/01/2008.12/31/9999.0000000000.04784....................
00780.NO .0000056.014.02/01/2008.12/31/9999.0000000000.04784....................
00780.NO .0000330.015.02/01/2008.12/31/9999.0000000000.04784....................
00780.NO .0000020.000.02/01/2008.12/31/9999.0000000000.04784....................
00780.NO .0000000.002.02/01/2008.12/31/9999.0000000000.04784....................


Except the first record, all other records formatted to 9(7).9(3). But the first record, we see there was a low-value was added in the decimal field.
Ie., 0000003.5 0

I hope there is a small changes required in our existing sysin, Could please give me your valuable suggestion.

Our current SYSIN
Back to top
View user's profile Send private message
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Thu Jul 03, 2008 11:25 pm    Post subject: Reply with quote

Please use BBCode (see FAQ). It makes your data more readable.
_________________
....Terry
Back to top
View user's profile Send private message Send e-mail
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 Previous  1, 2, 3  Next
Page 2 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