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

Reg: Assembler (Reads VSAM records backward)


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
GAFUR

New User


Joined: 19 May 2005
Posts: 31

PostPosted: Thu Jan 17, 2008 6:33 pm
Reply with quote

Guys,

I am still in learning stage of assembler. Here iam pasting one assembler program coded by me . This program reads one VSAM file backward starting from last record and writes into one sequential file. The program executed successfully ang got the expected results.

The one thing here what i am doing is i am displaying file status code in sysprint dataset after reading and writing of each record.

Its showing the file status - 776.

Could you please let me know what is this file status code about?
Instead of showing file status - 0 why is it showing 776.


please scroll down to see program and results.

000100 VSAM008 CSECT
000700 STM 14,12,12(13)
000800 BALR 12,0
000900 USING *,12
001000 ST 13,SAVE+4
001100 LA 13,SAVE
001200 ******************************************************************
001300 *READS KSDS FILE SEQUENTIALLY BACKWARD
001400 *AND WRITES INTO SEQFILE
001500 *WRITE MESSAGES INTO SYSPRINT
002000 ***********************************************************************
002400 OPEN (VS01)
002500 LTR 15,15
002600 BNZ OPENERR1
002700 OPEN (SEQ02,OUTPUT)
002800 LTR 15,15
002900 BNZ OPENERR2
003000 POINT RPL=RPL01
003100 LTR 15,15
003200 BNZ GENERR1
003300 LOOP GET RPL=RPL01
003400 LTR 15,15
003500 BNZ GENERR1
003600 MVC BUFFER2,BUFFER1
003700 PUT SEQ02,BUFFER2
003800 LTR 08,15
003900 * BNZ PUTERR1 *********ERROR************
004000 WTO 'RECORD INSERTED SUCCESSFULLY'
004100 CVD 08,DW
004110 BAL 14,STAT
005100 B LOOP
005200 EOFILE CLOSE (VS01)
005300 CLOSE (SEQ02)
005400 L 13,SAVE+4
005500 RETURN (14,12),,RC=0
005600 *
005700 *
005800 OPENERR1 WTO 'ERROR ON OPENING VS01',ROUTCDE=11
005900 L 13,SAVE+4
006000 RETURN (14,12),,RC=8
006100 *
006200 OPENERR2 WTO 'ERROR ON OPENING SEQ02',ROUTCDE=11
006300 L 13,SAVE+4
006400 RETURN (14,12),,RC=8
006500 *
006600 OPENERR3 WTO 'ERROR ON OPENING SYSPRINT',ROUTCDE=11
006700 L 13,SAVE+4
006800 RETURN (14,12),,RC=8
006900 *
007000 GENERR1 WTO 'RECORD NOT FOUND'
007100 SHOWCB RPL=RPL01,AREA=FDBKAREA,LENGTH=4,FIELDS=(FDBK)
007200 L 4,FDBKAREA
007300 CVD 4,DW
007310 BAL 14,STAT
007320 B EXITERR1
007400 STAT ST 14,STAT14
007410 UNPK STATUS,DW
007500 OI STATUS+L'STATUS-1,X'F0'
007600 MVC OUTREC+14(4),STATUS+4
007700 MVC OUTREC+1(14),=CL14'FILE STATUS = '
007800 OPEN (SYSPRINT,OUTPUT)
007900 LTR 15,15
008000 BNZ OPENERR3
008100 PUT SYSPRINT,OUTCARD
008200 CLOSE (SYSPRINT)
008201 L 14,STAT14
008210 BR 14
008300 EXITERR1 CLOSE (VS01)
008400 CLOSE (SEQ02)
008500 L 13,SAVE+4
008600 RETURN (14,12),,RC=16
008700 *
008800 PUTERR1 WTO 'RECORD NOT INSERTED'
008810 CVD 08,DW
008900 BAL 14,STAT
009000 B EXITERR2
010300 EXITERR2 CLOSE (VS01)
010400 CLOSE (SEQ02)
010500 L 13,SAVE+4
010600 RETURN (14,12),,RC=12
010700 ******************************************************************
010800 *
010900 *
011000 ***********************************************************************
011100 SR 15,15
011200 L 13,SAVE+4
011300 L 14,12(0,13)
011400 LM 0,12,20(13)
011500 BR 14
011600 ***********************************************************************
011700 * STORAGE SECTION
011800 ***********************************************************************
011900 VS01 ACB MACRF=(KEY,SEQ,IN), X
012000 DDNAME=VS01,EXLST=EXLST1
012100 RPL01 RPL ACB=VS01,AREA=BUFFER1,AREALEN=20,RECLEN=20, X
012200 OPTCD=(KEY,SEQ,BWD,LRD,NUP,MVE)
012300 EXLST1 EXLST EODAD=EOFILE
012400 SEQ02 DCB DDNAME=SEQ02,MACRF=PM,DSORG=PS, X
012500 LRECL=20,RECFM=FB
012600 SYSPRINT DCB DDNAME=SYSPRINT,MACRF=PM,DSORG=PS, X
012700 LRECL=137,RECFM=VBA
012800 BUFFER1 DS CL20
012900 BUFFER2 DS CL20
013000 KEYVS01 DS CL4
013100 KEYVS02 DS CL4
013200 FDBKAREA DS F
013300 DW DS D
013400 STATUS DS CL8
013500 MSG DC AL2(18)
013600 DATA DS CL18
013700 OUTCARD DC AL2(137),AL2(0)
013800 OUTREC DC CL133' '
013810 STAT14 DC F'0'
013900 SAVE DS 18F
014000 END
****** **************************** Bottom of Data ****************************


Results:


VSAM input file : VS01

AAAA1111111111114444
BBBB2222222222222222
CCCC3333333333333333
DDDD4444444444444444
EEEE5555555555555555
FFFF6666666666666666
GGGGGHHHHHHHHHHHHHHH

Seq outfile: SEQ02

GGGGGHHHHHHHHHHHHHHH
FFFF6666666666666666
EEEE5555555555555555
DDDD4444444444444444
CCCC3333333333333333
BBBB2222222222222222
AAAA1111111111114444


Display in SYSPRINT

FILE STATUS = 776
FILE STATUS = 776
FILE STATUS = 776
FILE STATUS = 776
FILE STATUS = 776
FILE STATUS = 776
FILE STATUS = 776




Thanks.
Abdul.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Jan 17, 2008 6:48 pm
Reply with quote

Nice achievement - even if a little bit too sophisticated for learning
( sorting an forward processing is less prone to errors )

Since You have been able to write the program
You should not have any problem in searching the manual
starting from the messages and codes and following the actions suggested
or by looking at the macro reference for the meaning of the return/reason code

Just to be picky...
why open and close the printer file every time ???

usually all filed are opened at the beginning,
closed at the end
and if You want be very_very sophisticated close them when intercepting
an abend
Back to top
View user's profile Send private message
GAFUR

New User


Joined: 19 May 2005
Posts: 31

PostPosted: Mon Jan 21, 2008 7:23 pm
Reply with quote

enrico-sorichetti,

Thanks a lot for your valuable suggestion.
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 -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top