Joined: 02 Dec 2002 Posts: 624 Topics: 175 Location: Stockholm, Sweden
Posted: Mon Jun 26, 2023 9:42 am Post subject: Use of multiple copybooks to view a file in File manager
Let's start off by asking whether what I'm trying to do can be done at all.
Assume I have a file that contains 2 record layouts, one for copybook FRED and one for copybook BERT (these are in a PDS called COPY.COBOL).
The program that creates this file is called JOHN.
I would like to create a template (?) in FM that is called JOHN and that "realizes" that if the layout is of type FRED (based on a value in a "FRED" field), then show the record using a copybook definition defined in COPY.COBOL(FRED) , and if it is of type BERT, show using COPY.COBOL(BERT).
Obviously (?), I want to be able to scroll through the file and FM "selects" the correct layout based on the record layout.
I have read through the online manuals but am getting nowhere.
For example, I'm assuming that I can define a template called JOHN, and if I browse this member, I'll see one reference to FRED, and one to BERT. Trouble is, all I ever see is either one or the other, never both at the same time.
At one time (years ago), I had access to in-house documentation which my memory says explained how to do this, but I no longer have access to this.
Grateful for any suggestions. _________________ Michael
Joined: 26 Nov 2002 Posts: 12369 Topics: 75 Location: San Jose
Posted: Thu Jun 29, 2023 4:02 pm Post subject:
misi01,
Sigh ! You have member for more than 20 years and yet you simply cannot follow rules. One of the golden rule to start a new topic is
"Use meaningful topics (don't use the language/forum name/PGM name for the topic). Use a descriptive Title to explain your problem. "
A topic with title "File manager" does NOT help as to what the question is. A better title would be "how to use multiple copybooks to view/edit a file in File manager"
Joined: 26 Nov 2002 Posts: 12369 Topics: 75 Location: San Jose
Posted: Fri Jun 30, 2023 11:16 am Post subject:
misi01,
I edited the topic title. Credits to Peter Vandyke, here is a detailed example of how you can use multiple copybooks
01. From Filemanager main menu, choose the option 7 (Templates)
Code:
Process Options Help
ssssssssssssssssssssssssssssssssssssssssssssssssssssssss
FILEMGR ager Primary Option Menu
Command ===> 7
0 Settings Set processing options
1 View View data
2 Edit Edit data
3 Utilities Perform utility functions
4 Tapes Tape specific functions
5 Disk/VSAM Disk track and VSAM CI functions
6 OAM Work with OAM objects
7 Templates Template and copybook utilities
8 HFS Access Hierarchical File System
9 WebSphere MQ List, view and edit MQ data
10 CICS FM/CICS
11 Remote Remote System Definition
X Exit Terminate File Manager
02. On the next panel choose the option 1 (Workbench)
Code:
Process Options Help
sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
FILEMGR ager Copybook and Template Utility functions
Command ===> 1
1 Workbench Create, edit or update single templates
2 Print View or print copybooks or templates
3 Build Compile copybook(s) into template(s)
4 Update Update template(s)
5 Import Import template(s)
6 Export Export template(s)
03. On the next panel choose the CC Create template from copybook. Make sure you have "/" next to / Advanced copybook selection
Code:
Process Options Help
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
FILEMGR ager Template Workbench
Command ===> CC
CC Create template from copybook E Edit field/record in template
CM Create template from model U Update template from copybook
MC Map from copybook MT Map from template
Copybook:
Data set name . COPY.COBOL
Member . . . . FRED
Template:
Data set name . FILEMGR.TEMPLATE
Member . . . . MULTCPY
Model Template:
Data set name .
Member . . . .
Processing Options:
Enter "/" to select option
/ Advanced copybook selection
04. On the next panel provide ALL the PDS that contains your file layouts
Code:
Process Options Help
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
FILEMGR ager Copybook Library List
Command ===>
Copybook Library:
Data set name 1 'USERID.COPY.COBOL'
2
3
4
5
6
7
8
9
10
11
12
05. Now you are presented with the first copy book FRED. You need add the additional file layouts. Code "I" on the CMD line which will insert a new line
Code:
Process Options Help
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
FILEMGR ager Copybook Selection
Command ===>
Cmd R Member Lib 01 Field Name
*** **** Top of data ****
I FRED 1 N
*** **** End of data ****
06. On the new line created, enter the Now you are presented with the first copy book FRED. You need add the additional file layouts. Code "I" on the CMD line
Code:
FILEMGR ager Copybook Selection
Command ===>
Cmd R Member Lib 01 Field Name
*** **** Top of data ****
FRED 1 N
N
07. You can type BERT on the new line or any copybook that you want to include. You can repeat this process for adding all of the copybook members.
Code:
Process Options Help
sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
FILEMGR ager Copybook Selection
Command ===>
Cmd R Member Lib 01 Field Name
*** **** Top of data ****
FRED 1 N
BERT N
*** **** End of data ****
07. Type "E" on each of the copy members where we will specify the conditions
Code:
Process Options Help
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
FILEMGR ager Copybook Selection
Command ===>
Cmd R Member Lib 01 Field Name
*** **** Top of data ****
E FRED 1 N
E BERT N
*** **** End of data ****
08. You are presented with the first 01 levels of each copybook in the list. Code "E/b]" once again to add the filter criteria.
Code:
Process Options Help
sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
FILEMGR ager Record Type Selection
Command ===>
Processing Option: Template for segmented data
Cmd SIE Copybook Field Name
**** Top of data ****
E S FRED RECORD-LAYOUT
E S BERT RECORD-LAYOUT
**** End of data ****
09. The complete copybook is now shown and this is where you add your filtering criteria. Choose the option [b]1 ID selection
Code:
Process Options Help
sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
FILEMGR ager Field Selection/Edit
Command ===> 1
------------------------------------------------- Criteria - Enter 1 or 2 to specify expression by field
1 Id :
2 Sel:
Offset 0
Cmd Seq SHE Ref Field Name
**** Top of data ****
1 1 RECORD-LAYOUT
2 2 REC-ID
3 2 NAME
4 2 OTST-REK-DAT
**** End of data ****
10. Now add the criteria for the selection. In this example REC-ID is the field that determines the criteria. This is where I add the condition REC-ID = 'FRED'
Code:
Process Options Help
sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
FILEMGR ager Record Identification Criteria
Command ===>
Cmd Con ( Field Name Start Length Type Op Value
<-> - <---+----1----+----2----+----3----> <----> <----> <> <-> <---+----1----+----2----+-
*** **** Top of data ****
RECORD-LAYOUT 1 44 AN
AND REC-ID 1 4 AN = 'FRED'
AND NAME 5 30 AN
AND OTST-REK-DAT 35 10 AN
*** **** End of data ****
11. Once you are done with all of your selection criteria , Press F3 to EXIT out of this copybook and it will show the criteria you added at the TOP.
Code:
FILEMGR ager Field Selection/Edit
Command ===>
------------------------------------------------- Criteria - Enter 1 or 2 to specify expression by field
1 Id : #2 = 'FRED'
2 Sel:
Offset 0
Cmd Seq SHE Ref Field Name
**** Top of data ****
1 1 RECORD-LAYOUT
2 2 REC-ID
3 2 NAME
4 2 OTST-REK-DAT
**** End of data ****
12. Now press F3 to EXIT out of this copybook and will now need to process the next copybook.
13. Repeat step 10 and 11 for the copy book BERT
Code:
Process Options Help
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
FILEMGR ager Field Selection/Edit
Command ===> 1
------------------------------------------------- Criteria - Enter 1 or 2 to specify expression by field
1 Id :
2 Sel:
Offset 0
Cmd Seq SHE Ref Field Name
**** Top of data ****
1 1 RECORD-LAYOUT
2 2 REC-ID
3 2 REK-NR
**** End of data ****
14. Add the filtering condition
Code:
Process Options Help
sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
FILEMGR ager Record Identification Criteria
Command ===>
Cmd Con ( Field Name Start Length Type Op Value
<-> - <---+----1----+----2----+----3----> <----> <----> <> <-> <---+----1----+----2----+----3
*** **** Top of data ****
RECORD-LAYOUT 1 10 AN
AND REC-ID 1 4 AN = 'BERT'
AND REK-NR 5 6 PD
*** **** End of data ****
15. pressing PF3 shows the filter condition
Code:
Process Options Help
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
FILEMGR ager Field Selection/Edit
Command ===>
------------------------------------------------- Criteria - Enter 1 or 2 to specify expression by field -
1 Id : #2 = 'BERT'
2 Sel:
Offset 0
Cmd Seq SHE Ref Field Name
**** Top of data ****
1 1 RECORD-LAYOUT
2 2 REC-ID
3 2 REK-NR
**** End of data ****
16. Press F3 to completely exit out and you should see a meesage ‘Template saved’ at the top right corner. Now you can use the member MULLTCPY for all other filemanager functions like View/Edit or the Copy utility to process the different record types
Code:
Process Options Help
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
FILEMGR ager Template Workbench Template saved
Command ===>
CC Create template from copybook E Edit field/record in template
CM Create template from model U Update template from copybook
MC Map from copybook MT Map from template
Copybook:
Data set name . COPY.COBOL
Member . . . . FRED
Template:
Data set name . FILEMGR.TEMPLATE
Member . . . . MULTCPY
Model Template:
Data set name .
Member . . . .
Processing Options:
Enter "/" to select option
/ Advanced copybook selection
17. Now here is an example of how you would view your file data with different copybooks. Make sure you that you are using the template by selecting 1 for ABOVE for copybook/template option
Code:
Process Options Help
sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
FILEMGR ager View Entry Panel
Command ===>
Input Partitioned, Sequential or VSAM Data Set, or HFS file:
Data set/path name Your.Input.file +
Member . . . . . . (Blank or pattern for member list)
Volume serial . . (If not cataloged)
Start position . . +
Record limit . . . Record sampling
Copybook or Template:
Data set name . . 'USERID.FILEMGR.TEMPLATE'
Member . . . . . . MULTCPY (Blank or pattern for member list)
Processing Options:
Copybook/template Start position type Enter "/" to select option
1 1. Above 3 1. Key Edit template S Type (1,2,S)
2. Previous 2. RBA Include only selected records
3. None 3. Record number Binary mode, reclen 80
4. Create dynamic 4. Formatted key
Joined: 02 Dec 2002 Posts: 624 Topics: 175 Location: Stockholm, Sweden
Posted: Mon Jul 03, 2023 2:27 am Post subject:
Thank you for that. Worked a treat and passed what I call the "idiot test" (ie, read/follow the instructions to the letter and it works).
I have to say though, I'd already read the link you posted to the IBM manual more than once. That link and the instructions above that you posted were as similar as chalk and cheese. Not sure I'd ever have managed to figure it out from the online manuals.
I'll see if I can put together a word document that explains how you would do the same thing in IDz (though my immediate guess is that you have to ceate the XREF file in FMM under TSO first, but we shall see. I'll post it you when I'm done.
Thanks again. _________________ Michael
Joined: 02 Dec 2002 Posts: 624 Topics: 175 Location: Stockholm, Sweden
Posted: Thu Aug 03, 2023 2:28 am Post subject:
Thought I'd add this as "extra" documentation (though Peter's is very good).
I originally had a condition for a specific layout being chosen as the following
Quote:
Ä3 = 'WW-CREATE-TFT950' ! Ä3 = 'WX-DELETE-TFT950'
which would obviously result in a massively long string for multiple string text comparisons.
After reading the online help about the use of Rexx in conditions, I experimented my way to this (though this isn't really using Rexx)
Quote:
AND COPYNAME CO 'TFT950'
which resulted in the following condition
Code:
1 Id : TFLD('Ä3','CO','TFT950') +
2 Sel: +
Offset 0 CCSID
Cmd Seq SHE Ref Field Name Picture Type Start Length
**** Top of data ****
1 1 TFT950-GROUP AN 1 172
2 2 ORGNR 9(12) ZD 1 12
3 2 COPYNAME X(30) AN 13 30
4 2 TFT950 AN 43 130
Originally, I'd thought to use the Rexx POS fuction, but I couldn't figure out to phrase it via option 1. Whatever variation I tried, I received an error message.
The online help includes an example
Quote:
For example, if you want to select records in which characters 4-6 of field
Ä22 are the string 'NOT', you could specify:
SUBSTR(Ä22,4,3) = 'NOT'
but it doesn't show how to enter this via option 1. Where does the SUBSTR text go, where do 4 and 3 go, where does 'NOT' go? _________________ Michael
Joined: 26 Nov 2002 Posts: 12369 Topics: 75 Location: San Jose
Posted: Thu Aug 03, 2023 7:18 am Post subject:
misi01 wrote:
Quote:
For example, if you want to select records in which characters 4-6 of field
Ä22 are the string 'NOT', you could specify:
SUBSTR(Ä22,4,3) = 'NOT'
but it doesn't show how to enter this via option 1. Where does the SUBSTR text go, where do 4 and 3 go, where does 'NOT' go?
Misi01,
If the panels don't show the option of entering a substring, why not improvise( following Keep it SIMPLE) and split the long field name into a individual fields that you want to add a condition?
Joined: 02 Dec 2002 Posts: 624 Topics: 175 Location: Stockholm, Sweden
Posted: Fri Aug 04, 2023 2:28 am Post subject:
Unfortunately, the problem with that idea is that it can't (?) work.
The actual field names could vary quite a lot and are based on COBOL section names.
This means that in one scenario, it might be W-FETCHNEXT-TFT950 and in another WA-ISRT-TFT950 (the TFT950 will always be the same, but not where it is in the actual string).
That's why being able to use the POS function would have been good (okay, fortunately I can use the CO variation in this scenario)
But then comes the problem of how I enter the actual Rexx string in the FMM panel (which values go where) _________________ Michael
Joined: 26 Nov 2002 Posts: 12369 Topics: 75 Location: San Jose
Posted: Fri Aug 04, 2023 7:13 am Post subject:
misi01 wrote:
Unfortunately, the problem with that idea is that it can't (?) work.
The actual field names could vary quite a lot and are based on COBOL section names.
This means that in one scenario, it might be W-FETCHNEXT-TFT950 and in another WA-ISRT-TFT950 (the TFT950 will always be the same, but not where it is in the actual string).
That's why being able to use the POS function would have been good (okay, fortunately I can use the CO variation in this scenario)
But then comes the problem of how I enter the actual Rexx string in the FMM panel (which values go where)
misi01,
Sigh ! you seem fixated on one solution of REXX string and you never seem to look beyond it.
If it is dynamic COBOL section names, why not define the concerned field in the copybook as an array of 1 byte and occurs for "n" times where "n" is the full length. And then fill in the value as you need. _________________ Kolusu
www.linkedin.com/in/kolusu
Joined: 02 Dec 2002 Posts: 624 Topics: 175 Location: Stockholm, Sweden
Posted: Sat Aug 05, 2023 2:13 am Post subject:
You know what?
I think I'll simply submit the problem as a documentation error to IBM and let them waste time and money on fixing it/documenting it properly.
The online help clearly states that you can use a rexx function to select specific records, but gives no example of how to do it.
Your suggestion is for me to jump through all sorts of hoops to circumvent an IBM problem. The next person might not be able to use those hoops at all and NEEDS the rexx solution. _________________ Michael
Joined: 02 Dec 2002 Posts: 624 Topics: 175 Location: Stockholm, Sweden
Posted: Thu Aug 24, 2023 2:16 am Post subject:
After a telephone meeting with IBM, the answer as to how to use Rexx for selection was as follows:
Rather than using option 1
Code:
----------- Criteria - Enter 1 or 2 to specify expression by field -----------
1 Id : TFLD('Ä3','CO','TFT950') <------- my original attempt +
2 Sel: +
Offset 0 CCSID
Cmd Seq SHE Ref Field Name Picture Type Start Length
**** Top of data ****
1 1 TFT950-GROUP AN 1 172
2 2 ORGNR 9(12) ZD 1 12
3 2 COPYNAME X(30) AN 13 30
4 2 TFT950 AN 43 130
try the following instead
Code:
----------- Criteria - Enter 1 or 2 to specify expression by field -----------
1 Id : +
2 Sel: pos('TFT950', Ä3) > 0 <----- any (?) Rexx statement(s) that produce 0 or 1 +
Offset 0 CCSID
Cmd Seq SHE Ref Field Name Picture Type Start Length
**** Top of data ****
1 1 TFT950-GROUP AN 1 172
2 2 ORGNR 9(12) ZD 1 12
3 2 COPYNAME X(30) AN 13 30
4 2 TFT950 AN 43 130
There you have it. Simple (when you know how) _________________ Michael
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum