4

I am trying to print AFP to sysout but the FORMS parameter is not known (and cannot be known) by the JCL. My current solution is to create dynamic JCL and spin it to INTRDR, but this is a weak solution because the job will not be under the control of our scheduler... and thus, an abend or other issue will go unnoticed by night-time operators.

I started concocting a way to print the AFP via a COBOL program. I use BPXWDYN to create the SYSOUT DD dynamically, which allows me to set the FORMS parameter however I want. But the next step is dumping the AFP to that DD.

I thought I could call IEBGENER dynamically from my COBOL program, but that pulls a S0C4.

I can move the AFP records from one DD to the other in the COBOL program, but that limits me to one LRECL... and I have many different LRECL definitions for AFP throughout my system, and COBOL MUST know the LRECL at compile time.

Any thoughts? Is it possible to call IEBGENER dynamically and not get the S0C4? Any other ideas I haven't thought of?

Thanks in advance...

mswanberg
  • 1,285
  • 8
  • 20

2 Answers2

3

Have you thought of writing a small assembler program? You can specify the LRECL in your BPXWDYN call, and the DCB does not need to specify an LRECL; it will get it from the DCB parameters at OPEN time. A program to simulate IEBGENER is quite trivial.

Alternatively, look at calling SORT with a FIELDS=COPY parameter. SORT doesn't need the LRECL either. Or write a REXX script.

There are many ways of doing this; you just need to look outside the COBOL box.

zarchasmpgmr
  • 1,422
  • 10
  • 21
  • a) We lowly application programmers are held to COBOL applications only in my shop, and b) my Assembler is so rusty it would take me months to get back up-to-speed. REXX is verboten in production. SORT doesn't write to dynamic FORMS= parameters. But I see what you're saying... call SORT instead of IEBGENER. That just might work! – mswanberg Aug 06 '13 at 19:18
  • p.s. My whole application will be moving to Unix soon, so this will all be but an unhappy memory :-) – mswanberg Aug 06 '13 at 19:19
  • Assembler is like riding a bicycle. It will come back quickly. :) – zarchasmpgmr Aug 17 '13 at 16:04
  • You forgot a part... Like riding a bicycle WITH NO SEAT! :-) – mswanberg Aug 18 '13 at 22:12
  • BTW, update: calling sort dynamically also produced a S0C4, so I'm back to square one. – mswanberg Aug 18 '13 at 22:13
  • You have to build your seat in assembler. :) Where was the S0C4? I know that calling sort is fraught with errors and confusing parameter lists. BTDTTS. Drop me a private line if you'd like to take this off SOflw - my username @ gee mail. – zarchasmpgmr Aug 20 '13 at 20:35
  • 1
    The S0C4 was in SORT. In the end, I think I could just use SORT in standalone to COPY any AFP data set to one that is LRECL 30000 and just use that. None of my AFP files are bigger than that, and that should satisfy COBOL's needs. My whole system will be moving to Unix soon, so I am loathe to add too much complexity right now. – mswanberg Aug 23 '13 at 00:11
  • BTW, my assumption is that my dynamically created DD from BPXWDYN doesn't really exist in any program that gets called and that is what's causing the S0C4. LE doesn't seem to be like most other environments where the ENV gets passed to any child processes. Or maybe I'm just using it wrong. – mswanberg Aug 23 '13 at 00:15
  • Oh, you mentioned LE. Ugh. :) in all seriousness, I am curious on the whole series of layers. Please drop me a note on Gmail. Maybe we can help some poor person down the road. :) – zarchasmpgmr Aug 25 '13 at 19:00
0

Your question is not extremely clear but I'm wondering if you should consider using the ACIF utility program called APKACIF instead of IEBGENR. The utility will merge your data and resolve the AFP FORMDEF, PAGEDEF objects to a dataset or print stream.

MikeC
  • 408
  • 2
  • 4
  • 9
  • ACIF is used to divide an AFP stream into resources, indexes, and data. It's not for printing. Even so, your solution doesn't address the issue: dynamic FORMS= parameter for the print. Let me know what's not clear and I'll try to address it to add clarity. – mswanberg Aug 06 '13 at 19:16
  • Actually ACIF can be used for printing, We often used it for delivery of AFP to an internet browser. Just a different "printer" device. Those "resources" you mention happen to be the formdef/pagedef and OGL associated with the print stream. What I found unclear was the purpose you were aiming to achieve. ACIF may very well be inappropriate, but it wasn't clear what your goal was. As is, it appears you have suitable answers from others. I'm not sure I can add anything. – MikeC Sep 01 '13 at 20:44
  • I disagree (that you can't add anything). I would love to hear more about using ACIF for printing. What exactly doesone do and what would it be used for? – mswanberg Sep 03 '13 at 10:39
  • IBM has a product that installs in a web browser. You can search google for IBM AFP Viewer Plug-In. Here is a link that discusses the same topic: http://pic.dhe.ibm.com/infocenter/zos/v1r12/index.jsp?topic=%2Fcom.ibm.zos.r12.aopa000%2Faopi034011.htm – MikeC Sep 26 '13 at 22:23
  • We used the APKACIF utility to convert an AFP document to a print stream trapping the resources in an output dataset. We then FTP the document in binary mode to the workstation (or server) where a user who has the plugin installed in the web browser can pull up the documents and view them as if they had been printed on paper. APKACIF also provides an indexing service so that you can select specific documents for viewing. – MikeC Sep 26 '13 at 22:27
  • I am well familiar with the AFP Viewer plugin for IE. I don't use it because I have a robust AFP viewer that renders far more faithfully (fonts) and does tons the IE plugin won't (indexing on-the-fly, and such). And I would say you are not using ACIF to print, but rather to separate the resources from the images and then index the images for presentment to a webpage. Sounds very kludgy to me. We have an archival system that archives and indexes AFP (using TLE recs) and then can, via a web service call, convert the document on-the-fly to PDF for online presentment. Easy-peasy. – mswanberg Sep 28 '13 at 11:05
  • But of course, the above doesn't help me print... just send things to a web browser. – mswanberg Sep 28 '13 at 11:08
  • As I said, you already had better suggestions. Kludgy? Perhaps. It was sufficient for our needs. – MikeC Sep 29 '13 at 22:20