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

Use Line numbers dynamically in SKIPREC


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

New User


Joined: 30 Jul 2008
Posts: 5
Location: Chennai

PostPosted: Sat Aug 02, 2008 3:18 pm
Reply with quote

Hi,

Can you please tell me how to use dynamic line numbers in SKIPREC.
I want to read the line number from a data set and use it in SKIPREC.
Can anyone help me with this ?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Sat Aug 02, 2008 9:56 pm
Reply with quote

Hello Ramyar and welcome to the forums,

Please post some sample data, the output you want when that data is processed, and the "rules" for your process.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Sat Aug 02, 2008 11:01 pm
Reply with quote

There are several good examples that Frank has posted that show how to build Sort control inputs from file information.....
Back to top
View user's profile Send private message
ramyar_15

New User


Joined: 30 Jul 2008
Posts: 5
Location: Chennai

PostPosted: Tue Aug 05, 2008 4:39 pm
Reply with quote

hi...
This is to give more light on my query...
I have 2 files.

Input1
3

Input2
This is line 1..
This is line 2...
This is line 3...


File 1 has the line number.
File 2 has some content.


I need to read the line number from file1 using JCL.
I have to skip ( line number read from file1) line numbers in file2
and display the rest in a new file.

Can anyone please help me with this?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Aug 05, 2008 8:42 pm
Reply with quote

Hello,

Quote:
Can anyone please help me with this?
No one should try until you post the needed info that only you have. . .

What do you want as output from the little sample you've posted? More complete data would probably be good. . .

It should be fairly simple to read file 1 and generate whatever sort control you want if all you want is a skip and copy. . .
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: Tue Aug 05, 2008 10:44 pm
Reply with quote

Quote:
I need to read the line number from file1 using JCL.
I have to skip ( line number read from file1) line numbers in file2
and display the rest in a new file.


In your example, file 1 has 3 and file2 has 3 records. So if you mean that you want to use SKIPREC=3 against file2, then the output won't have any records so you can't display the rest. Do you just want to set up the following for use against file2:

Code:

   OPTION COPY,SKIPREC=n


where n is the number from file 1? If so, then you can use a DFSORT job like this:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
3
/*
//SORTOUT DD DSN=&&C1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  INREC BUILD=(C' OPTION COPY,SKIPREC=',1,1,80:X)
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
A
B
C
D
E
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD DSN=&&C1,DISP=(OLD,PASS)


For this example, SORTOUT for S2 will have:

Code:

D
E


If that's not what you want, then you need to explain more clearly what you do want.
Back to top
View user's profile Send private message
ramyar_15

New User


Joined: 30 Jul 2008
Posts: 5
Location: Chennai

PostPosted: Wed Aug 06, 2008 1:07 pm
Reply with quote

Thank u so much Frank..
I dint not ask what I wanted clearly but you clearly gave me what I needed.

But I have a problem again.
The Program is abending with ABENDU0016
I am giving you the program

//STEP02 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=FILE1,
// DISP=SHR
//SORTOUT DD DSN=TEMP1,
// DISP=(NEW,CATLG,DELETE),
// DCB=*.SORTIN,
// SPACE=(CYL,(8,10),RLSE)
//SYSIN DD *
OPTION COPY
INREC BUILD=(C'OPTION COPY,SKIPREC=',1,1,80:X)
/*

//STEP03 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYSOUD DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSIN DD DSN=TEMP1,DISP=SHR
/*
//SORTIN DD DSN=FILE2,
// DISP=SHR
//SORTOUT DD DSN=FILE3,
// DISP=(NEW,CATLG,DELETE),
// DCB=*.SORTIN,
// SPACE=(CYL,(8,10),RLSE)


I will also give the contents of the files

FILE1
3


FILE2
A
B
C
D
E


FILE3(EXPECTED OUTPUT)
D
E


TEMP HAS THE FOLLOWING
OPTION COPY,SKIPREC=3

BUT STILL IT IS ABENDING..

Please help...
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Aug 06, 2008 1:10 pm
Reply with quote

Hello,

You need to post all of the diagnostic informaton presented by the abended run. Use copy/paste and include the message numbers as well as the message text.
Back to top
View user's profile Send private message
ramyar_15

New User


Joined: 30 Jul 2008
Posts: 5
Location: Chennai

PostPosted: Wed Aug 06, 2008 1:14 pm
Reply with quote

This is the error messages I get in the abended run

ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 03:43 ON WED AUG
OPTION COPY,SKIPREC=3
$
ICE005A 0 STATEMENT DEFINER ERROR
ICE010A 0 NO SORT OR MERGE CONTROL STATEMENT
ICE751I 0 C5-K26318 C6-K90007 E7-K24705
ICE052I 3 END OF DFSORT


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

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Aug 06, 2008 1:27 pm
Reply with quote

Hi,

the control statements must not start in col 1.

In your
Code:
 INREC BUILD=(C'OPTION COPY,SKIPREC=',1,1,80:X)


it should be
Code:
 INREC BUILD=(C' OPTION COPY,SKIPREC=',1,1,80:X)



Gerry
Back to top
View user's profile Send private message
ramyar_15

New User


Joined: 30 Jul 2008
Posts: 5
Location: Chennai

PostPosted: Wed Aug 06, 2008 1:58 pm
Reply with quote

Thank u so much Gerry..
That helped
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Aug 06, 2008 2:04 pm
Reply with quote

By the way Frank's code was obviously not copied correctly


Gerry
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Reading dataset in Python - New Line ... All Other Mainframe Topics 22
Search our Forums:

Back to Top