.. index:: single: wsbank (Workspace Bank) single: G7 Command; listnames single: Splicing single: G7 Command; rename single: G7 Command; del single: G7 Command; cpress single: G7 Command; hpress single: G7 Command; btitle single: G7 Command; bupdate single: G7 Command; zap single: G7 Command; wsinfo The Workspace Bank: Making, Compressing, and Splicing Banks =========================================================== At any one time, *G7* has one workspace bank and 0 to 25 assigned banks. The workspace bank is the same physical bank throughout any one run of *G7* unless it is changed using the *wsbank* command explained below. Whenever *G7* needs a series, it looks first in the workspace and then, only if it does not find the variable there, it looks through the assigned banks. The original assigned bank, at position 'a', is specified in the G.CFG file that is read when the program starts. Additional banks may be loaded, replacing the bank in the 'a' slot or assigned to other positions. As *G7* forms variables with *f* commands or introduces variables with *data* commands, the newly created or introduced series are put into the workspace bank. Even the *update* and *mupdate* commands do not change the series in the assigned bank but put the revised series into the workspace. | **(lis)tnames [-srgv] [wildcard]** | **lnc [-srgv] [wildcard]** | Types the names of the variables in the workspace (w) or assigned bank (a), where "a" is any letter between 'a' and 'z' except 'w'. If the *save* command is on, the list will then appear both on the screen and in the saved file. Use of wildcard is optional, and like in DOS, '*' will match any number of characters. For any single character, however, you need to use '^', instead of '?' as in DOS. The *lnc* routine is identical to *listnames* but prints the series as a single column. Option 's' sorts the series in alphabetical order, and 'r' reverses the order. If a Vam file is associated with the G bank, then option 'g' prints only macro series and option 'v' prints only Vam bank series. **(bti)tle [bank title]** Displays the title and configuration of the workspace (w) or assigned bank ('a' through 'z' except 'w'). In the case of the workspace, you can supply a new title or change the existing one. It is useful to record the time and date of creation of data banks. This can be achieved easily by using the keywords "%time" and "%date" in the title. *G7* will replace these keywords with the actual time and date, respectively. This capability also can be used elsewhere in *G7*, including in the *vtitle* and *ic* commands. **(wsb)ank ** This makes the named bank the workspace. The bank name is expressed as in the bank command, above. Beware: the workspace now becomes the named bank and this bank will be changed by almost anything you do. In particular, a zap command (see below) will destroy the bank completely. Use this command with utmost caution. It is best to back up a bank before using it with this command. **(wsi)nfo** This command prints information to the screen about the current workspace bank, including its bank title, the number of series in the bank, the maximum number of observations per series, and the default starting year (base year) and period. .. _G7UGwscache: | **wscache ** | **wscache ** | When on, reading and writing to the standard workspace (WS.*) is suspended and data are held in memory. When first turned on, data are read from WS.*, and when turned off data are written to WS.*. Capacity in memory is greater than on disk because of known limitations of the GBanks design, and so pushing data from memory to disk will fail if the WS.* bank capacity is exceeded. In some cases, script processing speed may increase dramatically with use of this routine. .. _G7UGwsdump: **wsdump [<"tdates">]** This routine will dump data from the cache to a text file. Data may be printed according to the current *tdates* if the <"tdates"> option is specified. Otherwise, the routine will strip from the series any leading and trailing zeros, missing values, and garbage, and it only will print data that appear to be valid. This text file may be employed with *Banker* to compile compressed banks. **zap [[ []]]** Sets the number of series in the workspace to zero. Arguments after zap override those in the G.CFG file. "baseyr" overrides the line "Default base year of workspace." "starting period" overrides the line "First month covered." "nobservations" overrides the line "Default maximum number of observations per series." **del ** Delete the named series from the workspace data bank. The WS.BNK file physically is not reduced in size by a deletion, but if another variable is added to it after the deletion, it will be put in the space formerly occupied by the deleted variable. **(ren)ame ** Changes the name of a series in the workspace bank. **(bu)pdate = ** *bupdate* stands for bank update. This command takes the series x from the workspace, updates it with non-zero entries from series y, and stores it as x in the workspace. If x is not already in the workspace, bup will put it there with values from the assigned bank. "y" may be an expression. .. For updating or combining entire data banks using this command, use the procedure described below. **Making Data Banks: An Example** You want to make a G bank, to be called "prices" with data from a file called PRICES.DAT, which contains data in the form ready for use by *G7*. Each series has one observation per year. Data begin in 1965, and you want to save room for data or forecasts through 2020 (56 years). First, edit the G.CFG file to have the workspace begin in 1965 and the number of observations to 56 or more. Exit from *G7* and start it again. When *G7* starts, do "add PRICES.DAT". Then do "dos copy ws.* prices.\*" The "prices" bank should be ready to assign. **Compressing a Bank** Before returning to *G7*, you may wish to compress the bank with the cpress program. The command is just: **cpress ** In our example, the command would be :: cpress price and the result would be the two files price.cbk and price.cin. Generally, they will take up much less space than the original price.bnk and price.ind, which can now be deleted. Note, however, that compressed banks cannot be extended or modified with *G7*. In this form the bank would be assigned in *G7* by the command :: cbk price a To create a hashed bank rather than a compressed bank, use hpress. **Updating a Standard Data Bank** The easiest way to update is with the splice programs described in the help file on assigned banks. An alternative, older route is described here for updating standard banks, while the splice programs apply to compressed banks or hashed banks. In the method described here, the new data must not extend beyond the number of observations specified when the databank was created. In this alternative way, to update data in the PRICE bank, use the following procedure. 1. Put the new price data with appropriate update commands (not data commands) into a file (example: HOT.DAT) 2. Use the wsb command to make the databank files the *G7* workspace. :: Example: wsb price 3. Type :: add hot.dat When the add file ends, check that the series have been updated. 4. Use the wsb command to move back to the usual workspace: wsb ws **Updating A Standard Bank From Another Bank** The bupdate command updates one standard bank from another. Suppose that we have the existing "price" bank and a short bank of recent information in "newprice". Outside of *G7*, run the bups program. bups asks for the name of the databank and the name of the output file that will contain the bup commands. The lines of this output file will be of the form: **bup variable_name = variable_name** Example:: bup gnp = gnp There will be one line for each variable in the bank. Let us suppose that you choose to call the output file PRICE.BUP. In *G7*, do :: wsb price bank newprice add price.bup wsb ws The series in the "price" bank will now have all the data the "newprice" bank, plus any data they previously contained that was not updated.