Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Is there any utility to Initialise VSAM file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
VIKAS GAIKWAD

New User


Joined: 30 Nov 2006
Posts: 33
Location: MUMBAI

PostPosted: Mon Sep 03, 2007 9:14 am    Post subject: Is there any utility to Initialise VSAM file
Reply with quote

Hi,

Is there any utility to Initialise VSAM file?

Ony way is to EDIT vsam file, write dummy record in it, save.
Again open the file in EDIT mode, delete the dummy record, save.

But is there any standard utility to do this?


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

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Mon Sep 03, 2007 10:28 pm    Post subject:
Reply with quote

None that I know of.

I have a REXX somewhere that writes low and high value keys into a KSDS, and just leaves them there.

The workdsn is VB 2004

Code:

/* REXX ** POPULATE SELECTED VSAM KSDS WITH HIGH AND LOW HEX KEYS    */

Z = MSG('OFF')
ARG PF US SI .
IF PF = '.' THEN PF = ''
IF US = '.' THEN US = ''
IF SI = '.' THEN SI = ''

WORKDSN = STRIP(PF!!US!!SI!!"WORK")

S1 = "KEYLEN"
S2 = "RKP"
S3 = "REC-TOTAL"
S4 = "MAXLRECL"

"EXECIO * DISKR VSAMFLS ( STEM FLS. FINIS"
DO A = 1 TO FLS.0
  PARSE VAR FLS.A DSN
  DSN = STRIP(DSN)

  CX1 = 0
  CX2 = 0
  CX3 = 0

  X=OUTTRAP(LST.)
  " LISTC ENT('"DSN"') ALL"
  X=OUTTRAP(OFF)

  DO B = 20 TO LST.0

    IF CX1 <> 1 THEN IX1 = POS(S1,LST.B)
    IF CX2 <> 1 THEN IX2 = POS(S2,LST.B)
    IF CX3 <> 1 THEN IX3 = POS(S3,LST.B)

    IF IX1 <> 0 & CX1 <> 1 THEN DO
      KLN = STRIP(TRANSLATE(SUBSTR(LST.B,IX1+6,18),' ','-'))
      CX1 = 1
    END
    IF IX2 <> 0 & CX2 <> 1 THEN DO
      KPS = STRIP(TRANSLATE(SUBSTR(LST.B,IX2+6,18),' ','-'))
      RL1 = POS(S4,LST.B)
      RLN = STRIP(TRANSLATE(SUBSTR(LST.B,RL1+8,16),' ','-'))
      CX2 = 1
    END
    IF IX3 <> 0 & CX3 <> 1 THEN DO
      RCS = STRIP(TRANSLATE(SUBSTR(LST.B,IX3+9,15),' ','-'))
      CX3 = 1
    END

    IF CX1 & CX2 & CX3 THEN DO
      B = LST.0
      IF RCS <> 0 THEN DO
        SAY "RECORDS COUNT GT 0 FOR "DSN
        ITERATE A
      END
      "FREE  FI(WORK,VSAM)"
      "ALLOC FI(WORK) DA('"WORKDSN"') SHR"
      "ALLOC FI(VSAM) DA('"DSN"') SHR"
      IF KPS > 0 THEN AA = LEFT(' ',KPS)!!COPIES('00'X,KLN)
       ELSE AA = COPIES('00'X,KLN)
      QUEUE AA
      IF KPS > 0 THEN AA = LEFT(' ',KPS)!!COPIES('00'X,KLN)
       ELSE AA = COPIES('FF'X,KLN)
      QUEUE AA
      "EXECIO" QUEUED() "DISKW WORK ( FINIS"
      "FREE  FI(WORK)"
      "ALLOC FI(WORK) DA('"WORKDSN"') SHR"
      " REPRO IFILE(WORK) OFILE(VSAM) "
      SAY "RETURN CODE "RIGHT(RC,4)" FOR "DSN
      "FREE  FI(WORK,VSAM)"
      ITERATE A
    END
  END
END
Back to top
View user's profile Send private message
VIKAS GAIKWAD

New User


Joined: 30 Nov 2006
Posts: 33
Location: MUMBAI

PostPosted: Wed Sep 05, 2007 11:31 am    Post subject:
Reply with quote

Sorry Expat,

I don't EXX.

Thanks,

Vikas.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed Sep 05, 2007 10:35 pm    Post subject:
Reply with quote

VIKAS GAIKWAD wrote:
Sorry Expat,

I don't EXX.

Thanks,

Vikas.


You don't need to, I've written it for you icon_rolleyes.gif

All you need to do is to write the JCL to execute it.

I have stated what is required for the work file, VB 2004
and DD VSAMFLS contains a list of the files that you want initialise.

You can remove the lines below

ARG PF US SI .
IF PF = '.' THEN PF = ''
IF US = '.' THEN US = ''
IF SI = '.' THEN SI = ''

And replace

WORKDSN = STRIP(PF!!US!!SI!!"WORK")

with

WORKDSN = "the name of the dataset allocated to DD WORK"

and it should work
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts DB2 - TERMINATE utility vasanthz DB2 5 Mon May 15, 2017 11:49 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us