Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Omitting a few columns and extracting data from a file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
murali922

New User


Joined: 25 Jul 2005
Posts: 92
Location: India

PostPosted: Wed Jan 31, 2007 8:16 am    Post subject: Omitting a few columns and extracting data from a file
Reply with quote

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
View user's profile Send private message

Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Wed Jan 31, 2007 8:33 am    Post subject:
Reply with quote

Using JCL Sort this can be done easily. Search the forum you get answer
Back to top
View user's profile Send private message
murali922

New User


Joined: 25 Jul 2005
Posts: 92
Location: India

PostPosted: Wed Jan 31, 2007 8:42 am    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Jan 31, 2007 8:55 am    Post subject:
Reply with quote

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
View user's profile Send private message
murali922

New User


Joined: 25 Jul 2005
Posts: 92
Location: India

PostPosted: Wed Jan 31, 2007 9:08 am    Post subject: Re: Omitting a few columns and extracting data from a file
Reply with quote

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
View user's profile Send private message
murali922

New User


Joined: 25 Jul 2005
Posts: 92
Location: India

PostPosted: Wed Jan 31, 2007 9:15 am    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Jan 31, 2007 9:28 am    Post subject:
Reply with quote

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 icon_biggrin.gif
Back to top
View user's profile Send private message
murali922

New User


Joined: 25 Jul 2005
Posts: 92
Location: India

PostPosted: Wed Jan 31, 2007 9:47 am    Post subject: Re: Omitting a few columns and extracting data from a file
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Jan 31, 2007 8:08 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sorting group data rajella DFSORT/ICETOOL 4 Sun Jan 22, 2017 11:32 pm
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts how to recover an uncataloged VSAM da... archanamuthukrishnan All Other Mainframe Topics 3 Wed Jan 11, 2017 6:18 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 1 Mon Jan 02, 2017 11:16 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us