• No results found

16 Some more tricks with select lists; paragraphs

In document JofBASEcommaTAFofC (Page 79-89)

16 Some more tricks with select lists; paragraphs

:::::

T

here are some things that can be achieved using manipulations with select lists. And this might make life easier, sometimes a lot. For example, how to put all records in particular file to DL.DEFINE record? We can use a list to populate said record and it needs to contain data in the format “APPLICATION>@ID”. How to get such list? Easy:

Creation of a list for DL.DEFINE C:\sa-tafc> jrunT24.cmd

jsh ~ --> SELECT F.ABBREVIATION SAVING EVAL "’ABBREVIATION>’:@ID"

290 Records selected

> SAVE.LIST ABBR

290 record(s) saved to list ’ABBR’

jsh ~ --> EDIT.LIST ABBR .jBASE.el.1

Record ’.jBASE.el.1’ exited from file ’.’

List ’ABBR’ exited

16 SOME MORE TRICKS WITH SELECT LISTS; PARAGRAPHS

And now it’s ready for DL.DEFINE – as soon as we copy this list (since DL.DEFINE doesn’t respect JBCLISTFILE environment variable and is yet unable to locate our select list):

Copying a list into T24

C:\sa-tafc> jrunT24.cmd

jsh ~ --> COPY FROM C:\sa-tafc\&SAVEDLISTS& TO &SAVEDLISTS& ABBR 1 records copied

Now enter the list name into field select.list of DL.DEFINE record:

Taking a list into DL.DEFINE

Model Bank DL.DEFINE INPUT

UNIT.NAME... TMNS000-ALL.ABBR

---1. ---1. 1 GB DESCRIPTN ALL ABBREVIATION

2. 1 GB SHORT.DESC.. ALL ABBR 3 LANGUAGE/COUNTRY..

4. 1 INDICES...

5 OPERATION... S 6 SELECT.LIST... ABBR_

7 TOP.LEVEL.TYPE....

8 TOP.LEVEL.ITEM....

9. 1 FILE.NAME...

10. 1 RECO

11. 1. 1 RECORD.DESC.

12. 1 SAVED.FROM...

13. 1 SAVED.RELEASE..

14. 1 SAVED.DATE...

15. 1 RESTORED.USER..

16. 1 RESTD.COMPANY..

---29 JUN 2011 19:51:04 USER (09 AUG) VLADIMIR.K [8427,INPAGE 1 >>>3>>>

ACTION

Now press Enter and voila – we have 57 pages of the record being populated:

The list appears in DL.DEFINE

Model Bank DL.DEFINE INPUT

UNIT.NAME... TMNS000-ALL.ABBR

---16 SOME MORE TRICKS WITH SELECT LISTS; PARAGRAPHS

1. 1. 1 GB DESCRIPTN ALL ABBREVIATION 2. 1 GB SHORT.DESC.. ALL ABBR

3 LANGUAGE/COUNTRY..

4. 1 INDICES...

5 OPERATION... S 6 SELECT.LIST...

7 TOP.LEVEL.TYPE....

8 TOP.LEVEL.ITEM....

9. 1 FILE.NAME... ABBREVIATION 10. 1 RECO AGC

11. 1. 1 RECORD.DESC.

9. 2 FILE.NAME... ABBREVIATION 10. 2 RECO COND

11. 2. 1 RECORD.DESC.

9. 3 FILE.NAME... ABBREVIATION 10. 3 RECO FT

---29 JUN 2011 19:51:30 USER (09 AUG) VLADIMIR.K [8427,INPAGE 1 >>57>>>

ACTION

Using SELECT...SAVING EVAL we can construct quite complex output – for example, set of OFS messages to proceed every record in unauthorised file. See the example of that:

Creation of OFS messages for mass processing - step 1 C:\sa-tafc> jrunT24.cmd

jsh ~ --> SELECT FBNK.FUNDS.TRANSFER$NAU WITH RECORD.STATUS EQ INAU

SAVING EVAL "’FUNDS.TRANSFER,/A/PROCESS//0,INPUTT/123456,’:@ID"

29 Records selected

>

(Following this example you need to be careful with the field record.status – it might also contain such values as CNAU or RNAU.)

Creation of OFS messages for mass processing - step 2

> SAVE.LIST QWE

29 record(s) saved to list ’QWE’

Creation of OFS messages for mass processing - double-checking jsh ~ --> EDIT.LIST QWE

16 SOME MORE TRICKS WITH SELECT LISTS; PARAGRAPHS

Record ’.jBASE.el.2’ exited from file ’.’

List ’QWE’ exited

Launch tSS from jsh prompt:

Creation of OFS messages for mass processing - step 3

jsh ~ --> tSS TAG

<tSS version="1.1"><t24version>201015</t24version><t24pid>3508</t24pid>

<t24ofssource>TAG</t24ofssource><clientIP/></tSS>

Now copy and paste the first line from the saved list:

Creation of OFS messages for mass processing - step 4 FUNDS.TRANSFER,/A/PROCESS//0,INPUTT/123456,FT102217DKNB

16 SOME MORE TRICKS WITH SELECT LISTS; PARAGRAPHS WL.LT.MIN.BAL}WITHDRAWL MAKES A/C BAL LESS THAN MIN BAL,OVERRIDE:2:1=ACCT.DEBI T.COLLATERAL}ACCOUNT &, DEBIT TO COLLATERAL{10693}100283.2.1,OVERRIDE:3:1=ACCT .UNAUTH.OD}Unauthorised overdraft of & & on account &.{USD}24947.57}10693{USD{

24947.57{10693{100318{213{{,CURR.NO:1:1=1,INPUTTER:1:1=75_SUJA1_I_INAU_OFS_BRO

After that you can continue with copy/paste – even selecting all the rest at once will do.

(Though I noticed that – very seldom – some records were not processed so it’s better to issue again the main SELECT after you’ve finished.) Alternatively, you can put the file containing the SELECT list to the appropriate directory to be processed by batch file listener. Isn’t that a good replacement for EBS.AUTO.FUNCTION?

More about lists processing: two lists can be compared with logical “AND”, “OR” or

“XOR” operations applied to them. Here we’re getting T24 ACCOUNT records that were created, then edited but the changes are not yet authorised and therefore these records present in both “live” and “$NAU” files:

AND-LISTS example C:\sa-tafc> jrunT24.cmd

jsh ~ --> SELECT FBNK.ACCOUNT 3620 Records selected

> SAVE.LIST ACCT1

3620 record(s) saved to list ’ACCT1’

jsh ~ --> SELECT FBNK.ACCOUNT$NAU

16 SOME MORE TRICKS WITH SELECT LISTS; PARAGRAPHS

6 Records selected

> SAVE.LIST ACCT2

6 record(s) saved to list ’ACCT2’

jsh ~ --> AND-LISTS ACCT1 ACCT2 1 Records selected

> LIST ONLY FBNK.ACCOUNT USD109100001

1 Records Listed

To get account records that are new – that is, were created but not yet authorised so they appear in “$NAU” file only – we use a “negative” select:

NSELECT example

jsh ~ --> SELECT FBNK.ACCOUNT$NAU 6 Records selected

> NSELECT FBNK.ACCOUNT 5 Records selected

> LIST ONLY FBNK.ACCOUNT$NAU

@ID...

10014 22071 22063 46922 10022

5 Records Listed

If we use two subsequent SELECTs, results will differ under “jsh” and “sh” modes (be-cause the latter will not store the select list after first SELECT). See (we’ll use the option

“(R” to suppress error messages “Error 202 Record not on file”):

Two subsequent SELECTs under ‘‘jsh’’

jsh ~ --> SELECT FBNK.ACCOUNT$NAU

16 SOME MORE TRICKS WITH SELECT LISTS; PARAGRAPHS

6 Records selected

> SELECT FBNK.ACCOUNT (R 1 Records selected

> CLEARSELECT jsh ~ -->

Two subsequent SELECTs under ‘‘sh’’

C:\sa-tafc> jrunT24.cmd jsh ~ --> <F2>

sh ~ --> SELECT FBNK.ACCOUNT$NAU 6 Records selected

sh ~ --> SELECT FBNK.ACCOUNT (R 3620 Records selected

How to avoid this confusion? Use require-select keyword:

Two subsequest SELECTs under ‘‘sh’’- REQUIRE.SELECT used

C:\sa-tafc> jrunT24.cmd jsh ~ --> <F2>

sh ~ --> SELECT FBNK.ACCOUNT$NAU 6 Records selected

sh ~ --> SELECT FBNK.ACCOUNT REQUIRE.SELECT (R

!!! Error message A Select list was required and not supplied.

not found !!!

require-select is the correct solution in any case, since there might be no records at all in FBNK.ACCOUNT$NAU and that will be handled correctly.

By the way, we can automate this task creating so-called “paragraph” in VOC:

16 SOME MORE TRICKS WITH SELECT LISTS; PARAGRAPHS

Creation of paragraph C:\sa-tafc> jrunT24.cmd

jsh ~ --> JED VOC PA.SAMPLE

File VOC , Record ’PA.SAMPLE’ Insert 21:17:12

Command->

0001 PA

0002 SELECT FBNK.ACCOUNT$NAU

0003 SELECT FBNK.ACCOUNT REQUIRE.SELECT 0004 LIST ONLY FBNK.ACCOUNT$NAU

--- End Of Record

---Save and run it:

Execution of paragraph C:\sa-tafc> jrunT24.cmd

jsh ~ --> PA.SAMPLE USD109100001

1 Records Listed

Paragraphs can have parameters; they also have a possibility of interaction with the user.

See example:

Creation of login paragraph C:\sa-tafc> jrunT24.cmd

jsh ~ --> JED VOC K.LOGIN

File VOC , Record ’K.LOGIN’ Insert 21:26:33

Command->

0001 PA 0002 ETS 0003 EX

0004 DATA INPUTT 0005 DATA 123456 0006 DATA <<C2,’’>>

--- End Of Record

---Save and run it and (provided that login and password are correct) you are in the chosen application:

16 SOME MORE TRICKS WITH SELECT LISTS; PARAGRAPHS

Execution of login paragraph C:\sa-tafc> jrunT24.cmd

jsh ~ --> K.LOGIN AC

Model Bank ACCOUNT

--- LAST SIGN.ON, DATE: 30 JUN 2011 TIME: 14:45 ATTEMPTS: 0 ---30 JUN 2011 19:48:23 USER (09 AUG) INPUTTER [6485,IN]

ACTION

AWAITING FUNCTION

If you don’t want to disclose your password (which is indeed a good idea) – change the paragraph:

change in login paragraph 0001 PA

0002 ETS 0003 EX

0004 DATA INPUTT

0005 DATA <<PASSWORD>>

0006 DATA <<C2,’’>>

And then you’ll be prompted for the password (though your input will be still visible on the screen).

16 SOME MORE TRICKS WITH SELECT LISTS; PARAGRAPHS

Note: paragraphs can be started only in “jsh” mode.

For more information about paragraphs see jBASE knowledgebase. Being there also take a closer look at jCL – that’s another way to automate things. An example of its usage is in VOC entry related to default jBASE login (which can be triggered at session start using command jpqn VOC\loginproc instead of “jsh” in cmd file):

Default login to jBASE C:\sa-tafc> jrunT24.cmd

jsh ~ --> JED VOC loginproc

File VOC , Record ’loginproc’ Insert 22:04:19

Command->

0001 PQN

0002 OSTART GLOBUS Y/N 0003 IP%1

0004 IF %1 # "Y" IF %1 # "y" GO 99 0005 HEBS.TERMINAL.SELECT

0006 P 0007 HEX 0008 P

0009 99 Hjsh -s jsh 0010 PX

--- End Of Record

In document JofBASEcommaTAFofC (Page 79-89)