|
View previous topic :: View next topic
|
| Author |
Message |
murali922
New User

Joined: 25 Jul 2005 Posts: 92 Location: India
|
|
|
|
I have a file which is like below :-
| Code: |
I - EN123456
I - EN7891011
I - EN9862454 |
I want to extract the records omitting "I -" i.e the output file should be like below :-
| Code: |
EN123456
EN7891011
EN9862454 |
Is there any way to do it... please let me know. |
|
| Back to top |
|
 |
Devzee
Active Member
Joined: 20 Jan 2007 Posts: 684 Location: Hollywood
|
|
|
|
| Using JCL Sort this can be done easily. Search the forum you get answer |
|
| Back to top |
|
 |
murali922
New User

Joined: 25 Jul 2005 Posts: 92 Location: India
|
|
|
|
I have searched, but there isnt any requirement as simple as this. Since I am not too sure how to go about this, I have asked it againg.
Would be glad if someone can help ... |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
You can use the DFSORT OUTREC statement to do what you want.
| Code: |
| OUTREC FIELDS=(5,length) |
The above says to create the output record starting in byte 5 of the input/sort data for the number of bytes specified. If your records are 100 bytes long, this value will be 96 (i.e. 4 less than the record length). |
|
| Back to top |
|
 |
murali922
New User

Joined: 25 Jul 2005 Posts: 92 Location: India
|
|
|
|
The below is the JCL I already have. And the file gets created PV9793A.OUTPUT.FILE. Now should I add the Outrec along with the SORT card. I.E should the sort card be :-
| Code: |
SORT FIELDS=(1,2,CH,A)
INCLUDE COND=(6,2,CH,EQ,C'EN')
OUTREC FIELDS=(5,length) |
| Code: |
//PV9793AA JOB (UU506505625,NM),'WXX331.GUISE',CLASS=0,MSGCLASS=X,
// NOTIFY=PV9793A
//* SUBMITTED AT BROC6 7.030 AT 14:23:38 BY PV9793A FROM W9508DAC
//* SUBMITTED AT BROC6 7.030 AT 14:01:15 BY PV9793A FROM W9508DAC
/*ROUTE PRINT RMT14
//*
//SUPERC EXEC PGM=ISRSUPC,
// PARM=(DELTAL,LINECMP,
// '',
// '')
//NEWDD DD DSN=CHGMAN.CRSU.#003150.DCU(RLOLKY37),
// DISP=SHR
//OLDDD DD DSN=CHGMAN.CRSU.DCU(RLOLKY37),
// DISP=SHR
//OUTDD DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(1,1),RLSE),
// DISP=(MOD,PASS),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)
//STEP1 EXEC PGM=SORT
//SORTIN DD DSN=&&T1,DISP=MOD,
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)
//SORTOUT DD DSN=PV9793A.OUTPUT.FILE,
// DISP=SHR
//SORWK01 DD UNIT=SYSDA,
// SPACE=(CYL,(1,1),RLSE)
//SORWK02 DD UNIT=SYSDA,
// SPACE=(CYL,(1,1),RLSE)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,2,CH,A)
INCLUDE COND=(6,2,CH,EQ,C'EN')
/* |
|
|
| Back to top |
|
 |
murali922
New User

Joined: 25 Jul 2005 Posts: 92 Location: India
|
|
|
|
To be more clear, PV9793A.OUTPUT.FILE gets created, and its contents are :-
| Code: |
I - EN123456
I - EN7891011
I - EN9862454 |
But I want PV9793A.COUTPUT.FILE to have only :-
| Code: |
EN123456
EN7891011
EN9862454 |
So shall I change my original JCL's sort card to be :-
| Code: |
SORT FIELDS=(1,2,CH,A)
INCLUDE COND=(6,2,CH,EQ,C'EN')
OUTREC FIELDS=(5,length) |
|
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Yes, if you add the OUTREC statement after the INCLUDE you should be ok as far as reformatting the unwanted characters out of the output file.
I'm not sure why MOD is specified on the SORTIN DD - my preference would be OLD,DELETE. You also don't need the DCB info on SORTIN. It will automatically be detected up from the &&T1 input file.
From the data you posted, it appears that all of the records have the same value in pos 1&2 - sorting on those positions alone may not give the results you want. I'd recommend your sort fields be (at least) 1,13 depending on what other data mioght be in the records. It also looks like the INCLUDE is one position off - the EN appears to begin in pos 5 not 6.
DISP=SHR should not be used for output files. Is there some reason that the SORTOUT is not being created as a new file?
Give it a try and let us know how it works  |
|
| Back to top |
|
 |
murali922
New User

Joined: 25 Jul 2005 Posts: 92 Location: India
|
|
|
|
DISP = SHR is because I want the file to be reused everytime it runs. And there might be someother job trying to get access to this file as well.
I would try as you suggested and let you know.
Many thanks for the help ! Very glad.
Cheers. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
You're welcome.
A bit of understanding appears to be missing. A job CANNOT be writing that file while another is trying to access it!
Even if it would run somehow, imagine the situation if 2 jobs were writing and one job was reading the file at the same time. None of the results would be usable.
Specifying OLD will prevent this from happening. The first job running will hold the file until it completes then the next job may allocate the dataset. Also, if the volume may change, overwriting the file will not work well for you. It should be deleted and re-allocated each job. You could add an IEFBR14 at the start of the job to MOD,DELETE that dataset, then use NEW,CATLG in the SORTOUT. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|