Posted: Thu Jul 10, 2014 3:53 pm Post subject: Removing last "column" in a ";"-separate
Hope you can help me. I have got a dataset with a header line and a number of data-lines. The "columns" or "fields" are not in fixed positions. Instead they are separated with a ";"
Now the receiver of the dataset want us to remove the last "column" called "CustType" from the header and data-lines for a period of time. Or said in another way, all characters in a row from the position of the 4th ";" have to be replaced by <spaces>.
How can this be done in a fast way? I'm thinking of using Icetool / Dfsort but I do not have an idea to how - do you..?
INREC, IFTHEN=(WHEN=NONE,FINDREP to change C';' to X'FF' with DO=4, second IFTHEN=(WHEN=NONE,PARSE with ENDBEFR for C';' FIXEDLEN= maximum chaacters in first four columns, third IFTHEN=(WHEN=NONE,BUILD=(parsed-field), fourth IFTHEN=(WHEN=NONE with FINDREP to change X'FF' back to C';' again DO=4.
If the CustType is always four digits, there's another way. You could also use PARSE for all the fields, and then SQZ.
Have a go. Tell us what problems you get if you get some. What is the RECFM and LRECL?
Posted: Fri Jul 11, 2014 1:53 pm Post subject: To be more precise...
Thanks for the reply. Actually I was not very precise in my question. I simplified the actual problem. Here I'll try to address the missing points:
Lrecl = 256
Recfm = FB
Number of fields = 20
Number of separating signs ";"= 19
Max length of all fields = 215 bytes
Max start position of last field to be removed = 211 (The ";" before that has also to be removed)
The last field which has to be removed is allways 5 bytes long (values 00000-99999)
I hope this helps to solve the problem...
Note to W. Collins: I have not yet tried your solution. I wanted to post answer to the questions first as this might change the solution...
Although the suggestion still works (changing the obvious to 19), there is another way since the data at the end of the record is fixed in length.
Use INREC, IFTHEN=(WHEN=INIT with JFY for the whole 1,256, with SHIFT=RIGHT. Another IFTHEN=(WHEN=INIT with JFY for 1,251 with SHIFT=LEFT and follow that with 5X (which put five blanks in the last record positions, where the data you want to lose has been abandoned).
Basically, it shoves everything to the right so that the final field is in a fixed location, then shoves everything except that field back to the left (and clobbers the last five bytes).
If you have lots of data, try both solutions, as perhaps one is noticeably faster than the other.
Joined: 24 Jul 2011 Posts: 651 Location: Down on the pig farm
Posted: Sat Jul 12, 2014 2:21 am Post subject:
I believe it is changing the obvious to 18 as one wants to drop the last ';' and DO=4 should have been DO=3. Correspondingly the SHIFT=LEFT should be for 1,250 as it is required to drop the last field, 5 bytes, and the preceding ';', 1 byte. 5+1 = 6 bytes dropped and 5X becomes 6X. _________________ Regards
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