I have following input file with record length of 132 bytes. I want to replace word MONTH with current month name i.e. June or July or August etc.. based on current month.
Input File:
HELLO GUYS
TO: <ram@gmail.com>
FROM: <jagan@gmail.com>
SUBJECT: file has been received for MONTH successfully
Do NOT respond to this email. It is being sent from a machine.
Output File: MONTH should be replaced with June as current month is June
HELLO GUYS
TO: <ram@gmail.com>
FROM: <jagan@gmail.com>
SUBJECT: file has been received for June successfully
Do NOT respond to this email. It is being sent from a machine.
Requirement #0:
Learn how to make your questions attractive to volunteers who may decide to help you.
jaganmoni1 wrote:
Hi,
I have following input file with record length of 132 bytes. I want to replace word MONTH with current month name i.e. June or July or August etc.. based on current month.
Input File:
Code:
HELLO GUYS
TO: <ram@gmail.com>
FROM: <jagan@gmail.com>
SUBJECT: file has been received for MONTH successfully
Do NOT respond to this email. It is being sent from a machine.
Output File: MONTH should be replaced with June as current month is June
Code:
HELLO GUYS
TO: <ram@gmail.com>
FROM: <jagan@gmail.com>
SUBJECT: file has been received for June successfully
Do NOT respond to this email. It is being sent from a machine.
You might want to try this (assuming your input is FB80):
Code:
OPTION COPY
INREC IFTHEN=(WHEN=(1,8,CH,EQ,C'SUBJECT:'),
OVERLAY=(81:DATE2,
81:85,2,CHANGE=(09,C'01',C'January',
C'02',C'February',
C'03',C'March',
C'04',C'April',
C'05',C'May',
C'06',C'June',
C'07',C'July',
C'08',C'August',
C'09',C'September',
C'10',C'October',
C'11',C'November',
C'12',C'December')),HIT=NEXT),
IFTHEN=(WHEN=ANY,
BUILD=(C'SUBJECT: File has been received for ',
81,9,SQZ=(SHIFT=LEFT,TRAIL=C' successfully',LENGTH=44)))
END
Instead of the requirement:
Quote:
MONTH should be replaced with June as current month is June
actually
Quote:
The whole SUBJECT line has been replaced with completely new content; the original content has been eliminated.
For instance: the input message template like this one
Code:
SUBJECT: Unsuccessful file transfer for MONTH processing.
will be replaced with
Code:
SUBJECT: File has been received for June successfully
To say nothing about possible month substitution to other lines of message body, about hardcoded fixed positions of the replaced text, etc. etc.
The worst of all is: the TS has not a minor intention to learn something for his own future career. Only: "Do my job for me, from start to finish". Nothing else.
It was not part of the requirement, simple as that.
If so, it should be much easier and more clear just to generate the new message from scratch, rather than: using a message template text, but completely replace its content...