Page 1 of 1

replacing values

PostPosted: Sun Apr 26, 2015 11:00 pm
by pulcinella
Hello

I have a file of 304 positions with the following structure:

code1 PIC X(1)
code2 PIC S9(9) COMP-3
Filler1 PIC X(211)
Filler2 PIC X(87)

The INPUT file is ordered by the first two fields (code1 and code2). No duplicate. The Filler1 has values ​​that are not important. The filler2 has several indicators, a position each indicator with the following values: "Y", "N", "T", "0" and "1". I need to change all values ​​"T" with "N" (filler2 positions 218 to finish)

example

Input file

code1 code2 filler-1 filler-2
F 00001 xxxxxxxxxxxxxx... N0N0N0Y1T0N0Y0T1T1T0Y0.......
F 00002 xxxxxxxxxxxxxx... T0N0Y0T1T0N0N0N1N1N0N0.......
F 00003 xxxxxxxxxxxxxx... Y0N0Y0Y1Y0N0N0N1N1N0N0.......
F 00004 xxxxxxxxxxxxxx... N0Y0T0N1N0T0T0Y1Y1Y0T0.......

Output file

code1 code2 filler-1 filler-2
F 00001 xxxxxxxxxxxxxx... N0N0N0Y1N0N0Y0N1N1N0Y0.......
F 00002 xxxxxxxxxxxxxx... N0N0Y0N1N0N0N0N1N1N0N0.......
F 00003 xxxxxxxxxxxxxx... Y0N0Y0Y1Y0N0N0N1N1N0N0.......
F 00004 xxxxxxxxxxxxxx... N0Y0N0N1N0N0N0Y1Y1Y0N0.......

I could use sentences OUTREC IFTHEN AND HIT NEXT but then I would have to ask for each indicator (218,1 - 220,1,...) of filler2 and change one to one but would have a huge statement (several lines) . There would be some way to change values indicating the column begins and ends (218,87)?

If I must change the " T" values ​​of some specific positions (for example positions: 220,1 - 226-1 - 228,1 - 234,1 - 236,1, 240,1 and 256,1, ) unused HIT NEXT, can it be done?

thank you a lot of

Re: replacing values

PostPosted: Mon Apr 27, 2015 2:34 am
by BillyBoyo
You can use FINDREP, with STARTPOS and ENDPOS, changing T to N.