IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to retrieve certain columns of a dataset


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 1208
Location: Bangalore,India

PostPosted: Wed Dec 13, 2006 4:55 pm
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
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
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
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: 1208
Location: Bangalore,India

PostPosted: Wed Dec 13, 2006 5:39 pm
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
Reply with quote

syncosrt

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

Moderator


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

PostPosted: Wed Dec 13, 2006 5:46 pm
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
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: 1208
Location: Bangalore,India

PostPosted: Wed Dec 13, 2006 5:51 pm
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
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
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
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Remote Unload of CLOB Columns DB2 6
No new posts Allocated cylinders of a dataset DB2 12
No new posts Increase the number of columns in the... IBM Tools 3
Search our Forums:

Back to Top