Computer Corporation of America
|
Feedback
Search CCA:
   
USA CCA
CCA Products
CCA Customer Support
CCA Resources
CCA - Company
CCAPRINT: A Newsletter for Model 204® and System 1032® Users
March 27, 2008
     
System 1032: DSDELIM – Extracting Data in Delimited Text Format Printer-friendly version
Model 204: Password Expiration and Other Security Features in V6R1.0 Printer-friendly version

 


System 1032
USE OF AND ACCESS TO PRODUCTS AND FEATURES ARE IN ACCORDANCE WITH THE TERMS AND CONDITIONS OF THE USER’S SOFTWARE LICENSE. THE PRESENTATION OF MATERIAL HEREIN DOES NOT, IN ANY MANNER, MODIFY SUCH TERMS AND CONDITIONS.

DSDELIM – Extracting Data in Delimited Text Format
By Tym Stegner

TymA customer had numerous datasets from which he wanted to extract all the data, so he could analyze it in Microsoft Excel. What was needed was a simple approach to performing this extraction from any particular dataset. Thus was born another useful utility, the DSDELIM tool.

Design Considerations
The DSDELIM tool is a utility (or program) that itself creates a program when it is run. In the case of DSDELIM, a dataset-specific DMC file is created that can extract records from a dataset into a vertical-bar (|) delimited text file. The generated program file has the name of the dataset with the DELIMIT file type.

There are two major reasons the DSDELIM tool produces a DMC, instead of directly outputting the delimited text.

  1. Firstly, processing becomes very costly when acquiring the value of an attribute, when the attribute name is not itself encoded into the program. To do so, DSDELIM would have to use EXECUTE statements or an API call to read in each attribute value itself. This would produce massive overhead for reading each record.
  2. Secondly, the reason is one of simplicity. The DSDELIM tool is only 58 lines long, and other than some FORMAT statements, the code is easy to follow.

DSDELIM Design Details
In this simple case, our requirements are straightforward: output a text file delimited with vertical-bar characters. The heading line for the file should be descriptive, so the defined TITLE for each attribute is used. If the TITLE is not defined, the automatic default is the primary name for the attribute, so there should not be any null titles.

Non-text attributes are handled with the following consideration. Using the A format specifier in a FORMAT statement will automatically suppress trailing spaces in a text field, so in the case of any non-TEXT attributes, they are converted into TEXT. Therefore, the data type of each attribute must be tested so that the program knows when such conversion must take place.

Functionally, the program needed to pass through the attributes in the dataset two times: first time for the titles, second time for the attribute names in the WRITE command. This is because the titles and attribute names are written to the output file in separate places and cannot be written in the same pass. To circumvent two passes through the dataset, DSDELIM makes a single pass through the dataset and stores the necessary information in an array, keyed by the ordinal position of the attribute in the dataset.

The DSDELIM tool makes use of the PL1032 procedure that accesses the API SHOW command, so the S1032_HLI library must be available.

While loading the array, the title information is also written to the output file. This saves the step of storing the title information into the array. Once the array is filled, a second loop is used to output the item list for the WRITE command, including a test for the data type. Those items that are not already text are converted into text using the $TEXT() function.

The DSDELIM Tool

!!  DSDELIM - Create a dataset-specify DMC to extract active records
!! from that dataset into a text delimited format.
!!
open library S1032_HLI in S1032_TOOLS readonly
var ax,nx integer
var delimit text varying init "|" !change value to change delimiter
var txbuf text varying
var z array (100) of group of !increase on -E-SUBRANGE error
nm text varying
tx logical init false
end_group
call show_int(nx, "NUMBER", $current_dataset,, "ATTRIBUTE")
init 1 $file($current_dataset&".DELIMIT")
write on 1 $current_dataset $current_dataset format(-
'set ds ' a / -
'find all' // -
'init 8 ' a '.txt' / -
'write on 8 format( -' )
for ax from 1 to nx do
call show_text(z.nm(ax), "NAME",, ax, "ATTRIBUTE") !Atr Name
call show_text(txbuf, "TITLE",, ax, "ATTRIBUTE") !title
write on 1 txbuf delimit format (3x '"' a a '" $ -')
call show_text(txbuf, "TYPE",, ax, "ATTRIBUTE") !data type
if txbuf beg "Text" or txbuf beg "User" then !is a text data type?
let z.tx(ax) = true
end_if
end_for !attr scan
write on 1 format( -
3x '" ")' / -
'write on 8 fmt(" ")'// - !force end-of-line from $ fmt
'for each record do' / -
' write on 8 -' )
for ax from 1 to nx do
if z.tx(ax) then
write on 1 z.nm(ax) format( 8t "#NAM'" a "' -" )
else
write on 1 z.nm(ax) format( 8t "$text(#NAM'" a "') -" )
end_if
end_for
write on 1 nx delimit format( 4t "format( " i3 '(a "' a '") )' )
write on 1 $current_dataset format( -
"end_for" / -
"release 8" / - 'write format("Created ' a '.TXT")' )
release 1
write $current_dataset format("Created DMC file " a ".DELIMIT")

Formatting FORMATs
The DSDELIM tool is primarily creating two specific WRITE commands with associated FORMAT statements.

For both WRITE commands, you must correctly envision the desired commands in the finished DMC to correctly specify the FORMAT statements in DSDELIM. The first WRITE command must include double quotes to surround the title text, as well as encompass the delimiter string. The third WRITE command must correctly include the required single quotes to encircle the attribute names as part of the #NAM specifier.

One of the tricks to writing these types of format statements is to know that single quotes can also be used to delimit text in a FORMAT statement. This is especially useful when you need to output text containing double quotes.

Generated Code
The following code is generated by the DSDELIM tool for the DIVISIONS dataset.

set ds DIVISIONS
find all
init 8 DIVISIONS.txt
write on 8 format( -
"Division Name|" $ -
"Div./ID|" $ -
"City|" $ -
"State//Province|" $ -
"Country|" $ -
"Division Budget|" $ -
"Profits|" $ -
" ")
write on 8 fmt(" ")
for each record do
write on 8 -
#NAM'DIVISION_NAME' -
$text(#NAM'DIVISION_ID') -
#NAM'CITY' -
#NAM'STATE' -
#NAM'COUNTRY' -
$text(#NAM'DIVISION_BUDGET') -
$text(#NAM'PROFITS') -
format( 7(a "|") )
end_for
release 8
write format("Created DIVISIONS.TXT")

An output channel is initialized, followed by a WRITE command to create the heading line for the output data. A record loop performs another WRITE command on the selected records in the dataset. All non-text data is converted to text, thus making the FORMAT portion of the WRITE command very simple. The “#NAM’…’” operator is used to ensure operation of the DMC file in the event that an attribute name happens to be a keyword, in which case an error would ensue.

Using the DSDELIM Tool
To use the DSDELIM tool, choose the dataset from which you need to extract data, and open it in a System 1032 session. The following example uses the DIVISIONS dataset located in the S1032_DEMO directory.

$ s1032
Computer Corporation of America System 1032 Version V9.81-1
Copyright 2002, Computer Corporation of America
1032> open ds divisions in s1032_demo read
Current dataset is now DIVISIONS
1032>
1032> use DSDELIM
Initializing channel 1
Created DMC file DIVISIONS.DELIMIT
1032>
1032> use DIVISIONS.DELIMIT
6 DIVISIONS records found
Initializing channel 8
Created DIVISIONS.TXT
1032> exit
$
$ type DIVISIONS.TXT
Division Name|Div./ID|City|State//Province|Country|Division Budget|Profits|
Eastern Entertainment| 1|New York City|New York|USA| 1000000.00| 200000.00|
California Classic Films| 2|Hollywood|California|USA| 1200000.00| 225000.00|
Autre Chose Cinema| 3|Montreal|Quebec|Canada| 1250000.00| 225000.00|
Cine Quebec| 4|Montreal|Quebec|Canada| 1230000.00| 240000.00|
Cinemexico| 5|Mexico City|Mexico|Mexico| 2750000.00| 300000.00|
Vanguard Films| 6|Boston|Massachusetts|USA| 3000000.00| 275000.00|
$

The DSDELIM tool operates on DIVISIONS, the current dataset, creating the DIVISIONS.DELIMIT command file. It locates the active records in the DIVISIONS dataset, and applies the WRITE commands described in “Generated Code” to output the headings, followed by the data from within the dataset.

If the extraction needs to be repeated later after dataset updates or upon another dataset having the same structure as the DIVISIONS dataset, the DSDELIM program need not be run again, because the DIVISIONS.DELIMIT program can be reused.

Note that DSDELIM does not work upon a dataset containing arrayed attributes.

Other Extraction Solutions
If you have this sort of extraction problem, but are uncertain that using the DSDELIM tool is the best solution for you, please have a look at previous articles on this topic, which have resolved the problem a bit differently.

Keep in mind, however, that these solutions assume that you have some familiarity with System 1032’s programming environment.

In Summary
The DSDELIM tool presents a programmatic method of extracting the data from a generic dataset into a delimited text file, via a two-step process.

Using DSDELIM is only a brick in the programs designed for extraction, however, one brick at a time is how things get built.

 

Model 204
USE OF AND ACCESS TO PRODUCTS AND FEATURES ARE IN ACCORDANCE WITH THE TERMS AND CONDITIONS OF THE USER’S SOFTWARE LICENSE. THE PRESENTATION OF MATERIAL HEREIN DOES NOT, IN ANY MANNER, MODIFY SUCH TERMS AND CONDITIONS.

Password Expiration and Other Security Features in V6R1.0
By James Damon



Most Model 204 installations require users to logon to a Model 204 Online or Batch204 system to gain access to the organization’s data. Logon requires a valid User ID and password, which must be validated either by native Model 204 security or an external security interface: ACF2, RACF or TOPSECRET. CCASTAT is the file used in Model 204 security validation.

Many organizations have started to implement stricter logon security consisting of the following minimum requirements:

V6R1.0 of Model 204 satisfies these requirements with an enhanced CCASTAT security file, as well as other enhancements to LOGON processing. File and group passwords are unaffected by these enhancements.

Converting Existing CCASTAT files
The enhanced security features available in V6R1.0 require you to convert your existing CCASTAT file to a new format. (This conversion is optional and need not be performed if you have no requirement for enhanced logon security.) A new utility, ZCTLTAB, converts CCASTAT, which enables the password expiration feature with the following configuration parameters:

Following execution of the utility, each user ID/password entry in CCASTAT will increase in length from 26 to 34 bytes. This increase is generally not significant unless you have many thousands of user IDs. In that case, CCASTAT may require additional disk space.

Enhanced Logon Security in Operation
After CCASTAT has been converted with the ZCTLTAB utility, the parameters used to configure password expiration, are viewable with the VIEW command shown in Figure 1.

Figure1. Viewing password expiration parameters in CCASTAT

VIEW PWDEXP, PWDWARN, PWDPURGE
PWDEXP 30 PASSWORD EXPIRATION DAYS
PWDWARN 5 PASSWORD WARNING DAYS
PWDPURGE 180 PASSWORD PURGE DAYS

If the value of any of these parameters is equal to -1, then CCASTAT has not been converted to the new format.

After the conversion, a LOGLST command will show something similar to the following:

USER01      X'FF'     NONE  04/20/08  10/17/08 0     ALL
USER02 X'FF' NONE 04/20/08 10/17/08 0 ALL
USER03 X'FF' NONE 04/20/08 10/17/08 0 ALL
USER04 X'FF' NONE 04/20/08 10/17/08 0 ALL
USER05 X'FF' NONE 04/20/08 10/17/08 0 ALL

Assuming the conversion was run on 03/21/08 with the parameter values listed in Figure 1, the first date column is the date the user ID will expire. The second date column is the date, 180 days from the expiration date, that the user ID/password entry will be purged (deleted) from CCASTAT unless the password is reset. The column after that is a count of the number of unsuccessful logon attempts using this user ID.

Assuming these parameters are in effect, when a user, whose password has not been changed for 25 days, logs in that user will see the following message:

LOGON USERID
*** M204.0347: PASSWORD
*** M204.2634: YOUR PASSWORD WILL EXPIRE IN 5 DAYS

When a user’s password expires, the following message is produced at logon:

LOGON USERID
*** M204.0347: PASSWORD
*** M204.2639: YOUR PASSWORD HAS EXPIRED

At this point, the user ID and password can be reactivated by only the system mangager using the LOGCTL command. If this does not occur within the 180 days purge time, the user ID/password will be purged from CCASTAT.

Other Enhanced Security Features
Several other security features are also available when CCASTAT has been converted with the ZCTLTAB utility.

Revoking a User ID
When a user has attempted to logon more that three consecutive times with an incorrect password and has failed each time, the userid/password entry is in the same state as an expired entry. In that case, the following message is produced and the user ID/password is made inactive:


LOGON USERID
*** M204.0347: PASSWORD
*** M204.0345: CCASTAT UPDATED
*** M204.2642: YOUR USERID HAS BEEN REVOKED: EXCESSIVE FAILED LOGON ATTEMPTS
*** 3 M204.0349: LOGON FAILED

A new password must be set by the system manager using the LOGCTL command to reactivate the entry.

Password Assignment
User’s may change their passwords during logon processing, if their logon privileges are set to X’10’. The following dialogue with Model 204 security will change a user’s password:


LOGON USERID
*** M204.0347: PASSWORD
oldpass:newpass
*** M204.2633: RE-ENTER NEW PASSWORD
newpass
*** M204.0353: USERID USERID LOGON 08 MAR 20 17.40
*** M204.0350: NEW PASSWORD ACCEPTED
*** M204.0345: CCASTAT UPDATED

Password assignment, under CCASTAT enhanced security, must adhere to the following rules. The new password must:

  1. Not be the same as the USERID, the current password, or the previous password.
  2. Be six, seven or eight characters long.
  3. Begin with an alphabetic character.
  4. Include at least one numeric character.

In Summary
If your organization has begun imposing enhanced security requirements, the changes to native Model 204 security may satisfy those requirements. The conversion to the new CCASTAT format is very easy and, once done, can be redone with new security parameters whenever requirements change.

These enhanced security features are available under all operating systems. Additional information regarding ZCTLTAB, JCL and parameter settings can be found in the Model 204 System Manager’s Guide in the chapter entitled “Storing Security Information (CCASTAT).”

 

Copyright © 2008 Computer Corporation of America.
All right reserved. Published in the United States of America.


Contact CCA Webmaster
Copyright 2008