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

copy fields of ksds to specific places of a sequential file.


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
silan

New User


Joined: 16 Jun 2006
Posts: 8
Location: new delhi

PostPosted: Fri Feb 23, 2007 1:55 pm
Reply with quote

Hi,

Here is my requirement:

I want to copy few fields of a ksds and store them at specific places of a sequential file.

This can be done easily in a program ,but i donot want to increase the production inventory for such a simple requirement .

I've very basic knowledge of DFSORT, but i guess this can be done thru DFSORT.

EX:field1 of KSDS to be stored in that field of sequential file that starts
at position 1, having length 3.

field2 of KSDS to be stored in that field of sequential file that starts
at position 8, having length 4.
etc.

-Regards
-Silan
Back to top
View user's profile Send private message
silan

New User


Joined: 16 Jun 2006
Posts: 8
Location: new delhi

PostPosted: Fri Feb 23, 2007 2:04 pm
Reply with quote

Hi members,

yes, i can do like this:

1 .copy the entire ksds thru IDCAMS.
2 .exclude the unwanted fields thru DFSORT.

But again can i do these in a single step thru DFSORT?????

Any possibilities experts!


-regards
-silan mohanty
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Feb 23, 2007 2:26 pm
Reply with quote

Sort can take KSDS files as input.
Sort can include/omit based upon conditions.
Sort can reformat.

Yes, this can be done in a single step.
Back to top
View user's profile Send private message
silan

New User


Joined: 16 Jun 2006
Posts: 8
Location: new delhi

PostPosted: Fri Feb 23, 2007 3:17 pm
Reply with quote

Thanks for confirming!

Will you please give the sysntax.yhat will be really helpful

-rgards
-Silan Mohanty
Back to top
View user's profile Send private message
guptae

Moderator


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

PostPosted: Fri Feb 23, 2007 3:32 pm
Reply with quote

Hi There,

Quote:
field1 of KSDS to be stored in that field of sequential file that starts
at position 1, having length 3.


Please give starting position & offset of the field which u want to copy in seq file.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Feb 23, 2007 3:35 pm
Reply with quote

silan wrote:
Will you please give the sysntax.yhat will be really helpful
Go to the "Manuals" link at the top of the page and download a sort manual.
Back to top
View user's profile Send private message
silan

New User


Joined: 16 Jun 2006
Posts: 8
Location: new delhi

PostPosted: Fri Feb 23, 2007 3:47 pm
Reply with quote

Hi Ekta ,

KSDS sequential-file
--------------- ----------------------
<starting-position>,<length> <starting-position>,<length>
---------------------------------- ---------------------------------------
field1-> 1,3 shd be copied to 8,3
field2->9,6 shd be copied to 1,6
......................................................................
......................................................................

like this.

-Thanks
-Silan Mohanty
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Feb 23, 2007 10:00 pm
Reply with quote

Silan,

Are the records of the KSDS fixed-length (all the same length) or variable-length? How you would do this depends on the answer. See the following for more information:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA20/1.8.3.4?SHELF=&DT=20060615185603&CASE=
Back to top
View user's profile Send private message
aqilis

New User


Joined: 23 Feb 2007
Posts: 17
Location: NOIDA

PostPosted: Mon Feb 26, 2007 1:01 pm
Reply with quote

Hi Frank!,
even i have a similar requirement.I have to extract 3 fields from a KSDS
say the fields are:( The first value indicates starting position and the second field indicates the length)

1,4
8,3

so for each record in the KSDS ,i want to select these two fields only and
place them at the following position of a sequential file- 5,4 and 23,3 respectively.Actually I have to populate the sequential file as per a cobol copybook layout, so the other fields has to be initialized (so as i think).

Please give the syntax.

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

Active User


Joined: 26 Feb 2007
Posts: 126
Location: Chennai

PostPosted: Mon Feb 26, 2007 7:34 pm
Reply with quote

silan wrote:
Hi,

Here is my requirement:

I want to copy few fields of a ksds and store them at specific places of a sequential file.

This can be done easily in a program ,but i donot want to increase the production inventory for such a simple requirement .

I've very basic knowledge of DFSORT, but i guess this can be done thru DFSORT.

EX:field1 of KSDS to be stored in that field of sequential file that starts
at position 1, having length 3.

field2 of KSDS to be stored in that field of sequential file that starts
at position 8, having length 4.
etc.

-Regards
-Silan


control cards
-------------


INREC=(1,80)....it depends upon ur file length
SORT FIELDS=COPY
OUTREC=(1:1,3,5X,8:4,4)


According to the above control cards
Field1 position in input file is from 1st position
Field2 position in input file is from 4th position

let me knw if u have any QUERY.........
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Feb 26, 2007 8:07 pm
Reply with quote

silan wrote:
field1-> 1,3 shd be copied to 8,3
field2->9,6 shd be copied to 1,6

Outrec (5:13,6,12:4,3)
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Feb 26, 2007 8:11 pm
Reply with quote

aqilis wrote:
1,4
8,3
so for each record in the KSDS ,i want to select these two fields only and
place them at the following position of a sequential file- 5,4 and 23,3 respectively.

Outrec (9:5,4,27:12,3)
You'll have to specify how you want the rest of the record initialized.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Feb 26, 2007 8:20 pm
Reply with quote

First off, quit quoting everything from a prior post unless needed, only an idiot would not have the brains to scroll up to see the original post.
ibmmainframesyntel wrote:
OUTREC=(1:1,3,5X,8:4,4)
Second off, if you had bothered to read what Frank had written and follow the very concise link, you would know that you need to account for the llbb of variable length files.
Frank Yaeger wrote:
Are the records of the KSDS fixed-length (all the same length) or variable-length? How you would do this depends on the answer. See the following for more information:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA20/1.8.3.4?SHELF=&DT=20060615185603&CASE=
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Feb 26, 2007 9:47 pm
Reply with quote

"mainframe professional" - you have posted control statements with invalid syntax more than once now.

Code:

   INREC=(1,80)....it depends upon ur file length
   SORT FIELDS=COPY
   OUTREC=(1:1,3,5X,8:4,4)


If you had bothered to test this, you would have received syntax errors. And there's no reason to use both the INREC and OUTREC statements here. And you've assumed that the KSDS is fixed-length (which it might be but probably isn't). A KSDS can always be processed as variable-length but cannot always be processed as fixed-length.

Please stop posting untested control statements. And please stop quoting everything.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Feb 26, 2007 10:08 pm
Reply with quote

Silan,

If you want your output file to be VB, you can use this DFSORT job:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (KSDS)
//SORTOUT DD DSN=... output file (VB/14)
//SYSIN    DD    *
  OPTION COPY
  RECORD TYPE=V
  INREC BUILD=(1,4,5:13,6,12:5,3)
/*


If you want your output file to be FB, you can use this DFSORT job:

Code:

//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (KSDS)
//SORTOUT DD DSN=... output file (FB/14)
//SYSIN    DD    *
  OPTION COPY
  RECORD TYPE=V
  OUTFIL VTOF,OUTREC=(1:13,6,8:5,3)
/*
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top