View previous topic :: View next topic
|
Author |
Message |
sen_1983us
New User
Joined: 21 May 2005 Posts: 21 Location: Hyderabad
|
|
|
|
Hi all,
CAN any one tell me how to read lsat 5 recs from VSAm and also in Sequential files
Regards
Senthil |
|
Back to top |
|
|
rajesh_1183
Active User
Joined: 24 Nov 2005 Posts: 121 Location: Tadepalligudem
|
|
|
|
I think,this helps......
Code: |
//SORTIN DD DSN=INPUT FILE,DISP=SHR
//OUT1 DD DSN=OUTPPUT FILE,DISP=SHR
//SYSIN DD *
OUTFIL FILES=OUT1,HEADER1=(1:"COUNT=',&COUNT),NODETAIL
/*
|
This will write the no.of records in OUTPPUT FILE at 7th position...
In the COBOL pgm define a record layout like...
Code: |
01 out-rec.
05 filler pic x(6)
05 count-value pic 9(5)--->I don't know exact pic clause
|
then in the prog write a loop like.....
Code: |
MAIN-PARA.
OPEN THE REQ.FILES LIKE OUTPUT-FILE AND VSAM FILE
READ OUTPUT-FILE INTO OUT-REC
PERFORM PARA1 UNTIL I = COUNT-VALUE-5.
PERFORM PARA2 5 TIMES.
CLOSE ALL THE OPENED FILES
STOP RUN.
PARA1.
READ VSAM-FILE INTO WS-REC --->SOME SAMPLE RECORD
ADD 1 TO I.
PARA2. --->PARAGRAPH READING LAST 5 RECORDS
READ VSAM-FILE INTO WS-REC
|
corrections welcomed...........
Thanks,
Rajesh[/code] |
|
Back to top |
|
|
rajesh_1183
Active User
Joined: 24 Nov 2005 Posts: 121 Location: Tadepalligudem
|
|
|
|
I think we can also do the req. using REPRO...can any one suggest that...
Thanks,
Rajesh |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Rajesh wrote:
Code: |
OUTFIL FILES=OUT1,HEADER1=(1:"COUNT=',&COUNT),NODETAIL
|
This control statement is incorrect in several ways.
FILES=OUT1 is invalid. It should be FILES=OUT or FNAMES=OUT1.
"COUNT=' is invalid. It should be 'COUNT='.
&COUNT or COUNT cannot be used with HEADERx. It can only be used with TRAILERx.
The following is a valid control statement for creating a record with the count in positions 1-8:
Code: |
OUTFIL NODETAIL,REMOVECC,
TRAILER1=(COUNT=(M11,LENGTH=8))
|
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
CAN any one tell me how to read lsat 5 recs from VSAm and also in Sequential files |
You can now do this kind of thing quite easily using the new SUBSET operator of DFSORT's ICETOOL available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file
//OUT DD DSN=... output file
//TOOLIN DD *
SUBSET FROM(IN) TO(OUT) KEEP INPUT LAST(5)
/*
|
For complete details on the new SUBSET function and the other new functions available with PTF UK90013, see:
Use [URL] BBCode for External Links |
|
Back to top |
|
|
|