View previous topic :: View next topic
|
Author |
Message |
sakthi_ksv
New User
Joined: 20 Jul 2006 Posts: 48 Location: Chennai
|
|
|
|
Hi,
I have a sequential file with no copybook. In that I have to search for a string like 'CON'. My requirement is, I have to copy all the records of the i/p file to o/p file and if a record has the word 'CON', the data after the word 'CON' should not be copied to o/p file for that record alone.
Let me explain with a example.
consider records in the i/p file as follows.
abcdefg CON SIGHAL ABDCDEDD
aaaaaaaaa
bbbbbbbbb
The output should be
abcdefg CON
aaaaaaaaa
bbbbbbbbb
how can I do this in JCL through sort or File aid???
Thanks in advance,
Sakthi. |
|
Back to top |
|
|
hemanth.nandas
Active User
Joined: 18 Aug 2007 Posts: 120 Location: India
|
|
|
|
Hi Sakthi,
You can do it using DFSORT or COBOL Reference Modification.
I know COBOL Reference Modification. I will the code use that,
Code: |
IF WS-INREC(9:3) = 'CON'
MOVE WS-INREC(1:11) TO NEW-WS-INREC
WRITE OUTREC FROM NEW-WS-INREC
ELSE
WRITE OUTREC FROM WS-INREC
END-IF. |
|
|
Back to top |
|
|
sakthi_ksv
New User
Joined: 20 Jul 2006 Posts: 48 Location: Chennai
|
|
|
|
how can I do it fileaid or JCL (sort card).. I tried posting this question in JCL forum, but it got removed from that forum. COuld anyone please help me how can i accomplish this in JCL or Fileaid???
Thanks,
Sakthi. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello Sakthi,
Which sort product does your system use? It will probably be DFSORT or Syncsort.
Your topic was moved due to the earlier reference to "sort". As you may have noticed, DFSORT questions have "their own" place in the forum. Syncsort questions are usually dealt with in the JCL section.
Depending on which sort you use and how you continue with this requirement, your topic may stay here or be relocated. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Sakthi,
You can use a DFSORT job like the following to do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed for other attributes.
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
abcdefg CON SIGHAL ABDCDEDD
aaaaaaaaa
bbbbbbbbb
xyz CON qrst
xyz abc rst CON mnopqrst
cc cccc rrrr qqq
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC PARSE=(%01=(ENDAT=C'CON',FIXLEN=80)),
BUILD=(%01)
|
SORTOUT would have:
Code: |
abcdefg CON
aaaaaaaaa
bbbbbbbbb
xyz CON
xyz abc rst CON
cc cccc rrrr qqq
|
|
|
Back to top |
|
|
|