Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to retrieve certain columns of a dataset

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
m.radhika

New User


Joined: 28 Mar 2006
Posts: 7

PostPosted: Wed Dec 13, 2006 4:51 pm    Post subject: How to retrieve certain columns of a dataset
Reply with quote

How to retrieve certain columns of a dataset
for ex i need only from col 20 to 30
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Wed Dec 13, 2006 4:55 pm    Post subject:
Reply with quote

Hi Radhika,

You can use sort for this.

Please use following sort card

Code:
OPTION COPY
OUTFIL OUTREC=(1:20,10)
Back to top
View user's profile Send private message
m.radhika

New User


Joined: 28 Mar 2006
Posts: 7

PostPosted: Wed Dec 13, 2006 5:12 pm    Post subject: Re: How to retrieve certain columns of a dataset
Reply with quote

it is showing some syntax error at outfil...and job getting abended
Back to top
View user's profile Send private message
Rajen

New User


Joined: 05 May 2005
Posts: 61

PostPosted: Wed Dec 13, 2006 5:14 pm    Post subject: Re: How to retrieve certain columns of a dataset
Reply with quote

Hi Radhika,
Please post ur jcl and error message.

Thanks,
Rajen.
Back to top
View user's profile Send private message
m.radhika

New User


Joined: 28 Mar 2006
Posts: 7

PostPosted: Wed Dec 13, 2006 5:18 pm    Post subject: Re: How to retrieve certain columns of a dataset
Reply with quote

//SYSIN DD *
SORT FIELDS=COPY
SORTOUT=(1:59,48)
/*

Sortout is my output file....correct me
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Wed Dec 13, 2006 5:39 pm    Post subject:
Reply with quote

Hey radhika,

Ur shop has syncosrt or dfsort?
Back to top
View user's profile Send private message
m.radhika

New User


Joined: 28 Mar 2006
Posts: 7

PostPosted: Wed Dec 13, 2006 5:41 pm    Post subject: Re: How to retrieve certain columns of a dataset
Reply with quote

syncosrt

Thanks
Radhika
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Wed Dec 13, 2006 5:46 pm    Post subject:
Reply with quote

Hi Radhika,

Code:
it is showing some syntax error at outfil...and job getting abended

Please provide ur jcl & error message
Back to top
View user's profile Send private message
m.radhika

New User


Joined: 28 Mar 2006
Posts: 7

PostPosted: Wed Dec 13, 2006 5:49 pm    Post subject: Re: How to retrieve certain columns of a dataset
Reply with quote

//SYSIN DD *
SORT FIELDS=COPY
SORTOUT=(1:59,48)
/*

Sytax error at sortout...Sortout is my outout dd name
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Wed Dec 13, 2006 5:51 pm    Post subject:
Reply with quote

Hey radhika,

Please give this as a sortcard

OPTION COPY
OUTFIL OUTREC=(1:20,10)
Back to top
View user's profile Send private message
Rajen

New User


Joined: 05 May 2005
Posts: 61

PostPosted: Wed Dec 13, 2006 5:58 pm    Post subject: Re: How to retrieve certain columns of a dataset
Reply with quote

This is what Ekta suggested you.
Code:
OPTION COPY
OUTFIL OUTREC=(1:20,10)


This is what you are using.

Code:
//SYSIN DD *
SORT FIELDS=COPY
SORTOUT=(1:59,48)
/*


I guess it should be OUTREC instead of SORTOUT!!!!

Thanks,
Rajen Patel.
Back to top
View user's profile Send private message
m.radhika

New User


Joined: 28 Mar 2006
Posts: 7

PostPosted: Wed Dec 13, 2006 6:02 pm    Post subject: Re: How to retrieve certain columns of a dataset
Reply with quote

//STEP01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SORTIN DD DSN=....,DISP=SHR
//SORTOUT DD DSN=.....
//SYSIN DD *
SORT FIELDS=COPY
OUTREC=(1:59,10)
/*

This is what am using am still getting same pblm
Back to top
View user's profile Send private message
Rajen

New User


Joined: 05 May 2005
Posts: 61

PostPosted: Wed Dec 13, 2006 6:12 pm    Post subject: Re: How to retrieve certain columns of a dataset
Reply with quote

Please paste your error message.
I dont know but u should not get this error message.

Thanks,
Rajen.
Back to top
View user's profile Send private message
m.radhika

New User


Joined: 28 Mar 2006
Posts: 7

PostPosted: Wed Dec 13, 2006 6:16 pm    Post subject: Re: How to retrieve certain columns of a dataset
Reply with quote

SYSIN :
SORT FIELDS=COPY
OUTREC=(1:59,10)
*
WER268A OUTREC STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE


Am getting above error message
Back to top
View user's profile Send private message
h.dinesh

New User


Joined: 06 Dec 2006
Posts: 46
Location: Chennai

PostPosted: Wed Dec 13, 2006 6:20 pm    Post subject:
Reply with quote

Radhika,

It should be

OUTREC FIELDS=(1:59,10)

Dinesh
Back to top
View user's profile Send private message
Rajen

New User


Joined: 05 May 2005
Posts: 61

PostPosted: Thu Dec 14, 2006 1:15 pm    Post subject: Re: How to retrieve certain columns of a dataset
Reply with quote

Hi Radhika,
Can you please try the code as Ekta has given you and please let us know if it worked or not.

Thanks,
Rajen Patel.
Back to top
View user's profile Send private message
reddy307
Currently Banned

New User


Joined: 09 Jun 2006
Posts: 18

PostPosted: Thu Dec 14, 2006 3:35 pm    Post subject:
Reply with quote

Hi
Try this

//SYSIN DD *
SORT FIELDS=COPY
INREC FIELDS=(7:2,5,20:10,3)
/*

EXPLANATION

1. SORT FIELDS=COPY

It is for copy records to output file

2. INREC FIELDS=(7:2,5,20:10,3) (for formatting)

Here we have two formattings,

1. 7:2,5 - data at 2nd position of input file with length 5
copied to 7th position of output file

2. 20:10,3 - data at 10th position of input file with length 3
copied to 20th position of output file



In above example, we can use OUTREC instread of INREC,

INREC adds, deletes, or reformats fields before the
records are sorted or merged. so that performance will
be improved

OUTREC adds, deletes, or reformats fields after the
records are sorted or merged.
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Mainframe dataset split purushottam DFSORT/ICETOOL 13 Tue Aug 29, 2017 12:28 pm
No new posts Unable to copy data from spool in a d... srikant314 JCL & VSAM 8 Fri Jul 28, 2017 9:10 pm
No new posts Extra character appears in file when ... Balu5491 All Other Mainframe Topics 1 Wed Jul 26, 2017 2:39 pm
No new posts Browse dataset cvnlynn CLIST & REXX 4 Tue Jul 18, 2017 3:52 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us