As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
We are running mainframe FOCUS (not WebFOCUS) and I have a question about using DYNAM CONCAT. In a program we wrote, we can have up to 5 files, all identical, that we want to concatenate together. However, in some cases, there may not be all five files. When we are missing, say FILE1 and use the following, we get errors:
We don't want to write a lot of code to check for the existence of (in this example) FILE1. How can we have a check for the existence of FILE1?
Also, we can have any permutation of the files - one run might have FILE1, FILE2 and FILE3 and then the next run might have FILE2, FILE4 and FILE5 and so on. That's why we don't want to write a ton of code.
Any ideas and suggestions will be appreciated.
And again, this is Mainframe FOCUS, not WebFOCUS.This message has been edited. Last edited by: Kerry,
Mainframe FOCUS, Rel 7.1.1 running on MVS/TSO Windows XP, Mainframe VM/CMS and MVS/TSO outputs in Reports, Excel, Flat file
Posts: 15 | Location: Texas | Registered: September 01, 2009
Please edit your posting and put the DYNAM command between code tags (for some weird reason, the DYNAM command was translated to HTML):
[CODE]
DYNAM CONCAT DDNAME FILE1 FILE2 FILE3 FILE4 FILE5
[/CODE]
If you have a separate Master for each of the five files, I would allocate the five files and then use the MORE statement (if they're already allocated, the the DYNAM ALLOC are not required):
DYNAM ALLOC FILE FILE1 DA ONE.TWO.THREE.DATA1 SHR REUSE
DYNAM ALLOC FILE FILE2 DA ONE.TWO.THREE.DATA2 SHR REUSE
DYNAM ALLOC FILE FILE3 DA ONE.TWO.THREE.DATA3 SHR REUSE
DYNAM ALLOC FILE FILE4 DA ONE.TWO.THREE.DATA4 SHR REUSE
DYNAM ALLOC FILE FILE5 DA ONE.TWO.THREE.DATA5 SHR REUSE
TABLE FILE FILE1
PRINT *
ON TABLE HOLD AS HCONCAT
MORE
FILE FILE2
MORE
FILE FILE3
MORE
FILE FILE4
MORE
FILE FILE5
END
I, luckily, don't have access to a mainframe to test this, but I think this will not give any errors for missing files.
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
Without looking anything up, how about a Dialogue Manager loop that checks the existence of each file, maybe by doing a DYNAM ALLOC for each file individually and checking the return code before adding it to the CONCAT.
Thanks for replying and apologies for messing up the code tags.
Question: If in running our program, only 3 files got processed, for example FILE2, FILE4 and FILE5, would some simple GOTO logic placed into your suggestion help with our plight? I used pseudocode below, not real actual code. We can have any permutation of file combinations. Almost forgot... these FILE1, FILE2, etc. files are created as HOLD files.... if I understand you, since the files are created, I would not need to use the DYNAM ALLOC code? How would I then check for file existence, in order to avoid having the DYNAM CONCAT code not bomb? I think I'm confused but hope I got my questions across.
-IF FILE1 doesn't exist GOTO CKFILE2
DYNAM ALLOC FILE FILE1 DA ONE.TWO.THREE.DATA1 SHR REUSE
-CKFILE2
-If FILE2 doesn't exist GOTO CKFILE3
DYNAM ALLOC FILE FILE2 DA ONE.TWO.THREE.DATA2 SHR REUSE
-CKFILE3
-IF FILE3 doesn't exist GOTO CKFILE4
DYNAM ALLOC FILE FILE3 DA ONE.TWO.THREE.DATA3 SHR REUSE
-CKFILE4
-IF FILE4 doesn't exist GOTO CKFILE5
DYNAM ALLOC FILE FILE4 DA ONE.TWO.THREE.DATA4 SHR REUSE
-CKFILE5
-IF FILE5 doesn't exist GOTO DONEALOC
DYNAM ALLOC FILE FILE5 DA ONE.TWO.THREE.DATA5 SHR REUSE
-DONEALOC
TABLE FILE FILE1
PRINT *
ON TABLE HOLD AS HCONCAT
MORE
FILE FILE2
MORE
FILE FILE3
MORE
FILE FILE4
MORE
FILE FILE5
END
Mainframe FOCUS, Rel 7.1.1 running on MVS/TSO Windows XP, Mainframe VM/CMS and MVS/TSO outputs in Reports, Excel, Flat file
Posts: 15 | Location: Texas | Registered: September 01, 2009
If they're created as HOLD files within the same fex as the rest of the code, then you have Masters for them, so my suggestion using MORE might be the best bet, and you won't need DYNAM commands.
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
I'm not that familiar with the MORE instruction. If I used your suggested MORE snippet, can I use it as is, or would I have to check for each file's existence?
Thanks for your replies and ideas.
Mainframe FOCUS, Rel 7.1.1 running on MVS/TSO Windows XP, Mainframe VM/CMS and MVS/TSO outputs in Reports, Excel, Flat file
Posts: 15 | Location: Texas | Registered: September 01, 2009
If the Masters for the four HOLD files all exist, then the MORE commands will work as is - whether there is data or not.
Read up on the MORE command - all the code goes before the first MORE command - after the first MORE command, the only valid statement other than the FILE statement are WHERE/IF statements for each MORE.
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
If your HOLD files are in FOCUS FORMAT, or you can convert to using HOLD FORMAT FOCUS, you could consider USEing the USE command...
For example:
-*
DYNAM ALLOC DD CAR DS DMB3.FOCUS.CAR SHR REUSE
-SET &COUNT = 0;
-*
-REPEAT ENDLABEL 5 TIMES
-SET &COUNT = &COUNT + 1;
-SET &COUNTRY = DECODE &COUNT('1' 'CHINA'
- '2' 'FRANCE'
- '3' 'ENGLAND'
- '4' 'JAPAN'
- '5' 'USA');
-SET &HOLDNAME = 'HOLD' | &COUNT;
TABLE FILE CAR
PRINT COUNTRY
IF COUNTRY EQ &COUNTRY
ON TABLE HOLD AS &HOLDNAME FORMAT FOCUS
END
-RUN
-ENDLABEL
-*
USE
HOLD1 AS HOLD1
HOLD2 AS HOLD1
HOLD3 AS HOLD1
HOLD4 AS HOLD1
HOLD5 AS HOLD1
END
-RUN
-*
TABLE FILE HOLD1
PRINT COUNTRY
END
Yields:
PAGE 1
COUNTRY
-------
FRANCE
ENGLAND
JAPAN
Pilot: WebFOCUS 8.2.06 Test: WebFOCUS 8.1.05M Prod: WebFOCUS 8.1.05M Server: Windows Server 2016/Tomcat Standalone Workstation: Windows 10/IE11+Edge Database: Oracle 12c, Netezza, & MS SQL Server 2019 Output: AHTML/XLSX/HTML/PDF/JSCHART Tools: WFDS, Repository Content, BI Portal Designer & ReportCaster