100%(2)100% encontró este documento útil (2 votos)
4K vistas18 páginas
The document discusses various command line utilities in Ab Initio that help understand Ab Initio functions better. It describes utilities for testing DML, inline transformations, databases and managing objects in the EME repository. Key utilities mentioned are m_dump for DML testing, m_eval for expression evaluation, m_db for database operations, air commands for project/sandbox creation and migration of graphs between environments.
The document discusses various command line utilities in Ab Initio that help understand Ab Initio functions better. It describes utilities for testing DML, inline transformations, databases and managing objects in the EME repository. Key utilities mentioned are m_dump for DML testing, m_eval for expression evaluation, m_db for database operations, air commands for project/sandbox creation and migration of graphs between environments.
The document discusses various command line utilities in Ab Initio that help understand Ab Initio functions better. It describes utilities for testing DML, inline transformations, databases and managing objects in the EME repository. Key utilities mentioned are m_dump for DML testing, m_eval for expression evaluation, m_db for database operations, air commands for project/sandbox creation and migration of graphs between environments.
Introduction Handy Ab Initio utilities help us to understand Ab Initio functions in a better way. Ab Initio command line utilities have the following basic advantages:
Makes developers to understand inline transformations better. Less dependent on GDE for understanding functionality of the dml, date functions which are more critical to the biz. Command line utilities are there for whole Ab Initio Software.
Types of Command Line Utilities GDE related Co>Operating System related EME related
GDE related
DML verification Inline transformation function testing Database verification testing
DML verification m_dump
If we require to test the dml for the feed, we can do with GDE using view data facility. Apart from this we have m_dump utility which prints information about data records, their record format, and the evaluations of expressions.
This DML utility prints information about data records, their record formats, and the evaluations of expressions. m_dump <metadata> [<data>] [<action> ]
2
Usage of Ab Initio Command Line Utilities
For example input file contents are like File name :- ip.dat Data :- 121CN
Its respective dml File Name :- k1.dml Record format :- record
decimal("") CLNSPD = "";
string("") XMPFID = "";
string("") NETTYP = NULL("");
string("") IA = NULL("");
string("") NEWLINE = ""; End;
For testing corrective dml for the input feed file we can use below command at command line
m_dump $AI_DML/k1.dml ip.dat
If we want to view a particular record of the feed file, we can do it by using GDE. Also we can view that record from command line.
Command to view particular record is :
m_dump $AI_DML/k1.dml ip.dat start 5 end 5
By using above command we can view the content of the record number 5.
If we want to know the total length of a particular record or DML file or size of the fields, then we can use the m_dump utility.
m_dump $AI_DML/test.dml -describe
3
Usage of Ab Initio Command Line Utilities
Output of the above command is:
Name
Offset Size
Type
cc_firm_msg2 0
1
string(1)
Filler_128 1
40
string(40)
end_of_firm_msg2 41
9
string(9)
firm_entries 50
7
string(7)
end_of_firm_msg3 57
35
string(35)
Filler_129 92
41
string(41)
Total 133
Inline transformation function testing m_eval
If we want to know a particular transformation (expression), how it works we require to run the graph through GDE or through command line utilities we can do the same.
The m_eval utility evaluates DML expressions in a shell and displays their derived types.
if we want to test the date format dml we can use below command m_eval '(date("DD- MMM-YYYY")) today() Result:"22-FEB-2010"
if we want to test what is the functionality of string_index function m_eval 'string_index("abcdefgh eieio", "e") Result: 5
4
Usage of Ab Initio Command Line Utilities
if we want to add two numbers m_eval '124+100' Result: 224
Database verification testing m_db
If we want to test the .dbc file is working fine or not or if we want to generate dml for the database table, these activities can be done by using m_db utility along with many other database related activities.
m_db command [ options ]
Run diagnostic tests against your database for this dbc file.
We can create a database table using m_db utility.
m_db create test.dbc -dml test.dml -table test_table The above command will create table test_table with the record format provided in the test.dml file.
We can truncate a database table using m_db utility.
m_db truncate test.dbc -table test_table
5
Usage of Ab Initio Command Line Utilities
EME related
These utilities are generally Air commands ( Ab Intio repository commands). Some of the important EME commandline utilities are:
Project creation Sandbox creation Project cloning Migration of graphs (Project to Project, EME to EME ) Check out Check in
Project Creation
Creates a new project and specifies various project attributes, including its location parameter name, a project parameter prefix, included common projects, and additional entries in the extension list.
[-extension pattern type [pattern type] ...] [-nodefault]
To create a project called test that includes a common project air project create /Projects/test -common /Projects/common 6
Usage of Ab Initio Command Line Utilities Sandbox Creation
Creates a sandbox in the specified path. The sandbox directory is created (if it does not exist) and marked as a sandbox, and the built-in sandbox directories are created.
air sandbox create path
[-template path]
[-prefix prefix]
[-replace s1 s2]
[-location location] [-nodirectories]
To create a sandbox called test_sandbox
air sandbox create /Application/Sandboxes/test_sandbox Project cloning
Copies the settings, but not the content, of the specified project to a new project. Settings include the project parameters, the extension list, common projects, and the start and end scripts.
air project clone source-project dest-project
To copy the settings of the lesson project into a new project called myproject air project clone /Projects/lesson /Projects/myproject 7
Usage of Ab Initio Command Line Utilities Migration of Ab Initio Objects (from Project to Project and EME to EME) Create a EME tag with a name corresponding to the release name on the Ab Initio graph to be migrated in a project residing on EME datastore.
air tag create <tag name> <project directory/graphname>
To create a tag for the graph test.mp in development environment air tag create tag_v1 /Projects/Development/mp/test.mp Verify the contents of the tag
air tag list -p <Tag name>
To verify the contents of the tag tag_v1
air tag list -p tag_v1
The Ab Initio graph is extracted from the source EME as a binary .SAVE file and transported to the target environment.
air save <save file name.SAVE> -from-tag <tag name>
To create a binary .SAVE file for the graph
air save test.SAVE -from-tag tag_v1
The .SAVE file is then transported from the source EME to the target EME
The .SAVE file can be transported from Development environment to production environment by using FTP method
8
Usage of Ab Initio Command Line Utilities Then the SAVE file is loaded into the target EME and the graph is checked out into the target sandbox.
To load the .SAVE file into the production environment air load test.SAVE -relocate /Project/Develoment /Project/Production
Check out
Check out updates the sandbox with the particular version of code that is being checked out from the EME. By default the latest version of any object is checked out, but we can check out any version of code we want.
A graph can be checked out from EME to the sandbox using the following command:
air project export <rpath> -basedir <basedir path> -files mp/<graphname> run/<scriptname>
To check out the graph test.mp from the EME to the sandbox air project export /Project/Production -basedir /Application/Sandboxes/Prod/ - files mp/test.mp run/test.ksh
Check in
Once the project files have been edited and updated they need to be checked in to create a new version in the EME datastore, which will be available for other users.
A graph can be checked in into EME using the following command air project import <rpath> -basedir <basedir path> -files mp/<graph name> run/<script name>
9
Usage of Ab Initio Command Line Utilities
To check in the graph test.mp into the EME
air project import /Project/Develoment -basedir /Application/Sandboxes/Test/ -files mp/test.mp run/test.ksh
Co>Operating System related
File management utilities Catalog management utilities Job management utilities Clean up commands Other commands
File management utilities
The Co>Operating System file management commands allow you to manage a set of distributed files in a multifile system as a single entry.
m_chmod
Changes the permissions of files, multifiles, directories, and multidirectories. m_du
Prints information about directory disk usage to standard output. m_mkdir
Creates a multidirectory in a multifile system. m_rm
Removes files, multifiles, directories, and multidirectories. m_touch
Creates a zero byte multifile or changes the timestamp of an existing file. m_cp
10
Usage of Ab Initio Command Line Utilities
Copies one or more multifiles.
m_df
Prints information about filesystem disk usage to standard output. m_rmdir Removes multidirectories. m_ls
Lists files, multifiles, directories, and multidirectories. m_mv
Moves or renames mulitifiles and multidirectories. m_mkfs
Creates a multifile system. m_rmfs
Removes a multifile system.
Catalog management utilities
The Co>Operating System file management commands provide a means of working with catalogs of lookup files. A catalog is a list of lookup files.
m_catalog_add
Adds a lookup file to a catalog.
The following example adds a lookup file named january_claims to the catalog test1 for the data file with the URL file://control/mfs/monthly/jan.dat.
The URL of file containing the record format for the data file is file://control/mdr/claims/monthly.dml, and the primary key for the lookup file is claim_id.
The following example deletes a lookup file named january_claims from the catalog test1
m_catalog_delete -catalog test1
-table january_claims
m_catalog_export
Prints the text representation of a catalog to standard output.
The following example prints the text representation of the catalog test1 to standard output:
m_catalog_export -catalog test1
m_catalog_import
Populates a catalog using a text representation from standard input.
The following example populates the catalog test1, using the text representation from the file test1.catalog-save as input: m_catalog_import -catalog test1 < test1.catalog-save
12
Usage of Ab Initio Command Line Utilities m_lscatalog
Lists the contents of a catalog in text form.
The following example lists all the lookup files in the catalog test1. The command has no -table or -data arguments. Note that the output from the command displays the optional Index URL and Flags fields only when there is a value for those fields in a table.
m_lscatalog -catalog test1
Table: january_claims Key: claim_id
Data URL: file://control/mfs/monthly/jan.dat Index URL: file://control/mfs/monthly/jan.index Metadata URL: file://control/mdr/claims/monthly.dml Flags: block_compressed keep_on_disk Table: customers Key: SSN
Data URL: mfile://fr1n01/CUSTOMERS
Metadata URL: file://control/mdr/dw/customers.dml
m_mkcatalog
Creates a catalog.
The following example creates a catalog names test1.
m_mkcatalog -catalog test1
m_rmcatalog
Removes a catalog.
The following example removes the catalog test1:
m_rmcatalog -catalog test1
13
Usage of Ab Initio Command Line Utilities
Job Management Utilities
The Co>Operating System job management commands are used to manage Ab Initio jobs in running state.
Some important job management commands are provided below
m_kill
This command is used to kill a running job.
m_kill test.rec
m_rollback
Rolls back a job to the last completed checkpoint, or to the beginning if the job has not completed any checkpoints.
m_rollback -kill test.rec
Kills a running job
m_rollback -d test.rec
Rolls back the job to the last completed checkpoint, or to the beginning if it has not completed any checkpoints, and then deletes its recovery file, log files, and many of the temporary files and directories and internal job-specific files the job created.
Cleanup commands The Co>Operating System cleanup commands do the following: Find any Ab Initio temporary files and directories on a computer Display the amount of disk space they use Remove them
14
Usage of Ab Initio Command Line Utilities The basic cleanup utilities are as follows:
m_cleanup
This command uses the specified job log files to list temporary files and directories.
m_cleanup -j job_log_file_name
m_cleanup_du
This command displays the amount of disk space used by the temporary files and directories specified by the job log file.
m_cleanup_du -j job_log_file_name
m_cleanup_rm
This command removes the temporary files and directories specified by the job log file.
m_cleanup_rm -j job_log_file_name
Other commands
Some of the other useful Co>Operating System utility commands are provided below: m_env
This command provides information about the Ab Initio environment's configuration variable settings.
This command has many argumets for different options. For example to obtain the version of the Co>Operating system we need to use the following command.
m_env -v
15
Usage of Ab Initio Command Line Utilities
m_password
This command is used to convert a text password to an encrypted form.