Removing last "column" in a ";"-separate

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
DizMan
Member
Posts: 2
Joined: Thu Jul 10, 2014 3:46 pm

Removing last "column" in a ";"-separate

Post by DizMan » Thu Jul 10, 2014 3:53 pm

Hi there...

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..?

Thanks in advance... :lol:


>> Input DSN <<

CustId;CustTitle;CustFirstName;CustLastName;CustType
1111;Manager;Peter;Lawson;1007
2222;Dr.;Liza;Jensen;6000
3333;Art director;Thomas;Williams;3099


>> Desired output <<
CustId;CustTitle;CustFirstName;CustLastName
1111;Manager;Peter;Lawson
2222;Dr.;Liza;Jensen
3333;Art director;Thomas;Williams

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Thu Jul 10, 2014 7:29 pm

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?

DizMan
Member
Posts: 2
Joined: Thu Jul 10, 2014 3:46 pm

To be more precise...

Post by DizMan » Fri Jul 11, 2014 1:53 pm

Hi again.

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...

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Fri Jul 11, 2014 2:31 pm

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.

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Sat Jul 12, 2014 2:21 am

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
Nic

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others