Hello.

I don't have z/OS so I can't do this myself.

Would someone who has z/OS be able to raise an
issue either directly with IBM or via SHARE?

The problem is that IBM's ftp has a great option
to preserve RDW when transferring a binary VB
file from mainframe to PC, but it doesn't have
an option to reverse that process.

You can see the use of the "rdw" option below.

I have 2 utilities available to reverse that, but I
would much prefer that IBM's ftp code handled
this itself so that I didn't need to rely on
non-standard utilities.

Thanks. Paul.




/*********************************************************************/
/*                                                                   */
/*  This Program Written By Paul Edwards.                            */
/*  Released to the public domain                                    */
/*                                                                   */
/*********************************************************************/
/*********************************************************************/
/*                                                                   */
/*  folks - read a VB (MVS) format file in binary mode, and process  */
/*  its contents. Note that the C standard allows binary files to    */
/*  be NUL-padded. This program allows for that.                     */
/*                                                                   */
/*  The intention of this program is to provide example PDPCLIB      */
/*  behaviour that should occur regardless of RECFM=F/V/U when       */
/*  opened in binary mode.                                           */
/*                                                                   */
/*********************************************************************/


/* Here is an example of transferring a VB file with
   "Hello there"
   "Folks"
   in it to the PC, preserving the RDW (Record Descriptor Word)
*/

/*
binary
 EZA1701I >>>TYPE i
 200 Type is Image (Binary)
 EZA1460I Command:
locsite rdw
 EZA1460I Command:
put folks
 EZA1701I >>>SITE VARrecfm Lrecl=256 Recfm=VB BLKSIZE=27998
 500 Syntax error, Command not recognized.
>>> PC ignores SITE command.  Use sendsite to suppress <<<
 EZA1701I >>>STOR folks
 150 Ready to receive "/C/folks". Mode STREAM Type BINARY.
 226 Transfer finished successfully. Closing data connection.
 EZA1617I 24 bytes transferred in 0.076 seconds. Transfer rate 0.32 Kbytes/sec.
 EZA1460I Command:
quit
*/


/* Here is an EBCDIC hexdump of the transferred file on arrival at the PC */

/*
000000  000F0000 C8859393 9640A388 85998500  ....Hello there.
000010  090000C6 969392A2                    ...Folks
*/

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
    FILE *fp;
    unsigned char lenb[4];
    int len;
    int c;
    int x;

    if (argc <= 1)
    {
        printf("usage: folks <fnm>\n");
        return (EXIT_FAILURE);
    }
    fp = fopen(*(argv + 1), "rb");
    if (fp == NULL)
    {
        printf("failed to open %s\n", *(argv + 1));
        return (EXIT_FAILURE);
    }
    while (fread(lenb, sizeof lenb, 1, fp) == 1)
    {
        len = lenb[0] << 8 | lenb[1];
        printf("len is %d\n", len);
        if (lenb[2] != 0 || lenb[3] != 0)
        {
            printf("file is corrupt - reserved\n");
            return (EXIT_FAILURE);
        }
        if (len == 0) /* allow for NUL-padding */
        {
            break;
        }
        if (len < 4)
        {
            printf("file is corrupt - length\n");
            return (EXIT_FAILURE);
        }
        c = fgetc(fp);
        printf("first data byte is %x\n", c);
        for (x = 5; x < len; x++)
        {
            fgetc(fp);
        }
    }
    return (EXIT_SUCCESS);
}

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to