Logics on Decimal field using REXX program



IBM's Command List programming language & Restructured Extended Executor

Logics on Decimal field using REXX program

Postby magesh123 » Sat Apr 16, 2011 12:07 am

Hi All,

This is my requirement. My input dataset contains the below format. i want to do validations on my decimal field(column 13 to column 18). After that
i will move the valid records into the output dataset.

Conditions:
1) first digit should be '0'
2) last digit should be 'C' --> as it is decimal field.
3) There should be only interger value(0 to 9) from column 13 to column 18
Ex for valid record: 2nd record
0001400046
invalid record: 1st record
00014A00038 --> 'A' should not be present here. so we need to omit this record.There should be only interger value(0 to 9) from column 13 to column 18.........


input dataset format:
12345678901234567890123 ----> Column no
0004 ¢ ð03210
4444FFFF4444004008FFFFF
00000004000001A03C03210
-----------------------
0004 %03210
4444FFFF4444004006FFFFF
00000004000001004C03210
-----------------------
0004 <03210
4444FFFF4444004004FFFFF
00000004000001005C03210



output dataset:(1st record should be omitted as it contains invaid decimal vaue)
0004 %03210
4444FFFF4444004006FFFFF
00000004000001004C03210
-----------------------
0004 <03210
4444FFFF4444004004FFFFF
00000004000001005C03210



Program skeleton:
"EXECIO * DISKR INFIL (STEM INF. FINIS)"
DO I = 1 TO INF.0
if (decimal_field(last char))='C' then
do
validate other_fields
if matches then
COPY RECS INTO OUTFILE(OUTPUT FILE)
ELSE
LEAVE THIS RECORD

end

END


Can anyone please suggest me to code the REXX PROGRAM for the above skeleton ?
magesh123
 
Posts: 13
Joined: Fri Apr 15, 2011 11:29 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Logics on Decimal field using REXX program

Postby prino » Sat Apr 16, 2011 12:49 am

Look at the X2C function
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 635
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 28 times

Re: Logics on Decimal field using REXX program

Postby Ronald Burr » Sat Apr 16, 2011 2:53 am

I believe that the C2X function is what is needed.

DO J=1 to INF.0
UNHEX = C2X(SUBSTR(INF.J,13,6)
IF SUBSTR(UNHEX,12,1) = 'C' THEN
DO
validate other fields
if matches then
COPY RECS INTO OUTFILE(OUTPUT FILE)
ELSE
LEAVE THIS RECORD

end

END
Ronald Burr
 
Posts: 7
Joined: Wed Mar 23, 2011 8:18 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Logics on Decimal field using REXX program

Postby prino » Sat Apr 16, 2011 3:10 am

Ronald Burr wrote:I believe that the C2X function is what is needed.

Oops, my mistake...
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 635
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 28 times

Re: Logics on Decimal field using REXX program

Postby NicC » Sat Apr 16, 2011 11:37 am

What you want is just 4 posts down from yours. Not that hard to search.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Logics on Decimal field using REXX program

Postby magesh123 » Mon Apr 18, 2011 8:05 am

Thank you very much for your help
magesh123
 
Posts: 13
Joined: Fri Apr 15, 2011 11:29 pm
Has thanked: 0 time
Been thanked: 0 time


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post