Joined: 26 Nov 2002 Posts: 12384 Topics: 75 Location: San Jose
Posted: Wed Aug 19, 2015 1:09 pm Post subject:
ponnagantiln,
Assuming your input file has an LRECL=80 and RECFM=FB and the numeric values start from position 5 use the folowing DFSORT JCL which will give you the desired results
Posted: Wed Aug 19, 2015 4:07 pm Post subject: Decimal values validation using DFSORT
Hi,
Thank you for quick response. However I am quite confused to code this. can you pleasehelp me on this. below is my JCL and I am able to validate upto 46th byte. the Amount field is like 9(10).9(10) and that starts from 47th position till 67. The maximun value is 10 digits before decimal and 10 deigits decimal. From the file that is from 47th position to 67th. How to check for valid and invalid records. From the input first 10 records are valid and from 11th onwards the amount is invalid. Can you please help this.
Code:
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
****** ***************************** Top of Data ******************************
000001 00001111111 8 S 20150529 256.42863
000002 00002222222 8 S 20150529 256423.63
000003 00003333333 8 S 20150529 25.642863
000004 00004444444 8 S 20150529 2564.28631111
000005 00005555555 9 S 20150529 255555.974
000006 00006666666 9 S 20150529 25534444.4444
000007 00007777777 8 S 20150529 2554444444.5555555
000008 00008888888 8 S 20150529 2553333333.4597455
000009 00009999999 8 S 20150514 5.11045
000010 00009999999 8 S 20150514 0.1
000011 00001111222 8 S 20150514 5.110451111111
000012 00001111222 8 S 20150514 6.1104511111111111
000013 00001111222 8 S 20150514 61111111111.111111
000014 00001111222 8 S 20150514 6.A123
Joined: 26 Nov 2002 Posts: 12384 Topics: 75 Location: San Jose
Posted: Wed Aug 19, 2015 4:42 pm Post subject:
ponnagantiln,
Please do not waste my time as well as your time. The above shown code is no where near what I suggested. You already have a lot of other validations which is done in the most round about manner and do you want to add the check for numeric along with the other validations?
It is tough to patch up a code without knowing the complete details. Is that an existing code and now you want to add the additional check? or did you code up that as a part of this requirement. _________________ Kolusu
www.linkedin.com/in/kolusu
Sorry for confusion. Thats existing code and I thought I can add this validation. Now instead of making complicate I like to write new sort fo rthis with two other validations as 1 to 10 as numeric check, 38 to 45 as Valid date check and 47 to 67 as Amount check. Amount is like 9(10).9(10). Can you please help me with this one.
Joined: 26 Nov 2002 Posts: 12384 Topics: 75 Location: San Jose
Posted: Fri Aug 21, 2015 12:48 pm Post subject:
ponnagantiln,
Use the following DFSORT JCL which will give you the desired results. I have added all your earlier checks as well as the numeric check for the new field and also the overflow of digits for the new field too.
IFTHEN=(WHEN=(001,11,FS,EQ,NUM,AND, $ CHECK FLD1 IS NUM
012,19,CH,EQ,C' ',AND, $ CHECK FLD2 IS SPACES
031,01,FS,EQ,NUM,AND, $ CHECK FLD3 IS NUM
032,01,CH,EQ,C' ',AND, $ CHECK FLD4 IS SPACE
033,01,SS,EQ,C'C,I',AND, $ CHECK FLD5 IS 'C' OR 'I'
092,10,FS,EQ,NUM,AND, $ CHECK IF DIGITS ARE NUM
103,10,FS,EQ,NUM), $ CHECK IF DECIMALS ARE NUM
OVERLAY=(114:C'V'),HIT=NEXT),
IFTHEN=(WHEN=(38,8,FS,EQ,NUM), $ CHECK IF DATE IS NUM
OVERLAY=(115:38,8,Y4T,TOGREG=Y4T)) $ VALIDATE THE DATE
SORT worked perfect for me and thanks again. I have one last question on this. would that be possible to format the decimal fields as 0000000256.4286300000 for Valid out put.
Joined: 26 Nov 2002 Posts: 12384 Topics: 75 Location: San Jose
Posted: Fri Aug 21, 2015 5:02 pm Post subject:
ponnagantiln wrote:
SORT worked perfect for me and thanks again. I have one last question on this. would that be possible to format the decimal fields as 0000000256.4286300000 for Valid out put.
Thanks,
Lakshmi
ponnagantiln,
Why do you have to add the requirements one after the another? How hard is to state the COMPLETE requirement instead of bits and pieces wasting our time as well as your time? You started off with something and then ended with up something else and now you have an additional requirement? Do you think people are working on your requirement all the time? People help out of their spare time and you can't expect them to go back and re-work on YOUR moving target requirement again and again do you? And once again your requirements are clear as dirt.
ponnagantiln wrote:
possible to format the decimal fields as 0000000256.4286300000 for Valid out put.
For the integer portion you decided to left pad with zeros which is the right way of handling numbers, but then for the decimals you started to right pad with zeros. So where is the consistency?
Is this the FINAL requirement or do you comeback once again with a new requirement? _________________ Kolusu
www.linkedin.com/in/kolusu
I am extremely sorry and its not my intention to waste your time by adding one after another. This is the final one and I am sure I dont give you any trouble. Thank you
Joined: 26 Nov 2002 Posts: 12384 Topics: 75 Location: San Jose
Posted: Sat Aug 22, 2015 1:23 pm Post subject:
ponnagantiln,
You really need to pay attention to what I said. You did NOT answer my question about the inconsistent left and right padding of zeros.
Anyway here are the untested control cards
Code:
//SYSIN DD *
OPTION COPY
ALTSEQ CODE=(40F0) $ CHANGE ' ' TO '0'
INREC IFTHEN=(WHEN=INIT,
PARSE=(%01=(ABSPOS=47,ENDBEFR=C'.',FIXLEN=11),
%02=(FIXLEN=11)),
OVERLAY=(092:%01,
092:092,10,TRAN=ALTSEQ, $ CHANGE ' ' TO '0'
103:%02,
103:103,10,TRAN=ALTSEQ, $ CHANGE ' ' TO '0'
124:%01)), $ ORIGINAL NUM DATA
IFTHEN=(WHEN=(001,11,FS,EQ,NUM,AND, $ CHECK FLD1 IS NUM
012,19,CH,EQ,C' ',AND, $ CHECK FLD2 IS SPACES
031,01,FS,EQ,NUM,AND, $ CHECK FLD3 IS NUM
032,01,CH,EQ,C' ',AND, $ CHECK FLD4 IS SPACE
033,01,SS,EQ,C'C,I',AND, $ CHECK FLD5 IS 'C' OR 'I'
092,10,FS,EQ,NUM,AND, $ CHECK IF DIGITS ARE NUM
103,10,FS,EQ,NUM), $ CHECK IF DECIMALS ARE NUM
OVERLAY=(114:C'V'),HIT=NEXT),
IFTHEN=(WHEN=(38,8,FS,EQ,NUM), $ CHECK IF DATE IS NUM
OVERLAY=(115:38,8,Y4T,TOGREG=Y4T)) $ VALIDATE THE DATE
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