Thursday, 5 June 2014

Modify existing field using sort

To modify a field when it matches the condition given in Sort:

//SYSIN DD *
      SORT FIELDS=COPY
      OUTREC IFTHEN=(WHEN=(7,6,CH,EQ,C'MAHESH'),OVERLAY=(80:C'POLICE MAN')))
/*

the above example is to overlay a particular field in a file using condition.

Here if 7 - position 6 - length CH - character EQ - equal to C - character  (Mahesh)  then
Over write at 80 - position C - character (police man)

Eg:

Hai I Mahesh and I am from Bangalore and my occupation is
Hai l Kumar and I am from sangagiri and my occupation is

Consider the above two lines are there in the OUTREC (output file)
When you use the sort the the output will be as below

Output
Hai I Mahesh and I am from Bangalore and my occupation is Police man
Hai l Kumar and I am from sangagiri and my occupation is

No comments:

Post a Comment

Expense Handler Application with advance technologies

Budget Planner  One of the application developed with Ionic 4 and Python-Flask.  Ionic 4 code:  https://github.com/logeshbuiltin/Expense...