Record formating!
Select messages from
# through # FAQ
[/[Print]\]
Goto page 1, 2  Next  :| |:
MVSFORUMS.com -> Utilities

#1: Record formating! Author: Rahul Bansal PostPosted: Wed Oct 15, 2003 8:58 am
    —
I have a input file which follows the sequence
Header ( 1 record)
data part( more than 1 records)
Footer ( 1 record)
Header ( 1 record)
data part ( more than 1 records)
Footer ( 1 record)
...and so on and so forth...

Sample of Header record ::
HY 031010021031 T44020
Here,T44020 is the name of the organization...which changes every time with new header record.

Now the Goal is to make a output file which should have all the above records but it also includes the name of the Organization in the "data part" at some position let say at column 65... and there are such many details in header record which i would like in "Data part" at some column position.

I mean to say let select a group 1 group of header,datapart & Footer. Now the data part has only amount value..rest is space...so i want to fill that space with the details like(Organization,etc) for that group...
and when next group comes the details is of second header and like this...

Is the above requirement possible by Sort./Icetool ?? Or shall I have write a code for it ?

Thanks
Rahul

#2:  Author: kolusuLocation: San Jose PostPosted: Wed Oct 15, 2003 9:59 am
    —
Rahul,

If easytrieve is available at your shop then it is very easy.Here is the sample code to get the desired results. I assumed that your input file LRECL is 80 and the header record is distinguished by 'HY' in the first 2 bytes , data record by 'DT' and the footer record by 'FT'.
Code:

//STEP0200 EXEC PGM=EZTPA00                                     
//STEPLIB  DD DSN=EASYTREV.LOADLIB,                   
//            DISP=SHR                                         
//SYSPRINT DD SYSOUT=*                                         
//SYSSNAP  DD SYSOUT=*                                         
//SYSUDUMP DD SYSOUT=*                                         
//INFILE   DD *                                                 
HY 031010021031 T44020                                         
DT 3000                                                         
DT 3001                                                         
DT 3002                                                         
DT 3003                                                         
DT 3004                                                         
FT ABCD                                                         
HY 031010021031 T44021                                         
DT 4000                                                         
DT 4001                                                         
FT BCDE                                                         
HY 031010021031 T44022                                         
DT 5000                                                         
DT 5001                                                         
FT CDEF                                                         
//OUTFILE  DD DSN=YOUR OUTPUT FILE,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE),
//            LRECL=80,RECFM=FB,BLKSIZE=0             
//SYSIN    DD *                                                       
                                                                     
  FILE INFILE                                                         
       IN-REC             01 80  A                                   
       TYP                01 02  A                                   
       ORG-NAME           17 06  A                                   
                                                                     
  FILE OUTFILE FB (0  0)                                             
       OUT-REC            01 80  A                                   
       O-NAME             65 06  A                                   
                                                                     
  W-ORG-NAME     W 06 A                                               

  JOB INPUT INFILE                                                   
                                                                     
      OUT-REC    = IN-REC                                             
      CASE TYP                                                       
           WHEN 'HY'                                                 
                W-ORG-NAME   = ORG-NAME                               
           WHEN 'DT'                                                 
                O-NAME       = W-ORG-NAME                             
           WHEN 'FT'                                                 
                O-NAME       = ' '                                   
      END-CASE                                                       

      PUT OUTFILE                                                     
 


The output from this job is
Code:

HY 031010021031 T44020                                                       
DT 3000                                                         T44020       
DT 3001                                                         T44020       
DT 3002                                                         T44020       
DT 3003                                                         T44020       
DT 3004                                                         T44020       
FT ABCD                                                                     
HY 031010021031 T44021                                                       
DT 4000                                                         T44021       
DT 4001                                                         T44021       
FT BCDE                                                                     
HY 031010021031 T44022                                                       
DT 5000                                                         T44022       
DT 5001                                                         T44022       
FT CDEF                                                                     


Hope this helps...

cheers

kolusu

PS: I am waiting to see if frank can pull this off with splice operator.

#3:  Author: Rahul Bansal PostPosted: Wed Oct 15, 2003 10:53 am
    —
Thanks for the Solution! But is the above solution possible by SORT or ICETOOL Or FILEAID ??

#4:  Author: Frank YaegerLocation: San Jose PostPosted: Wed Oct 15, 2003 11:33 am
    —
The only way to do this kind of thing with DFSORT is to use an E15 exit with the appropriate logic to propagate the field from each header record to its "group" of data records.

#5:  Author: Rahul Bansal PostPosted: Wed Oct 15, 2003 11:15 pm
    —
Hi,

What is E15 exit ??

Can u give my one sample Code ??

Where do I found the E15 Logic in the IBM site. I search but could not found E15 Logic.

#6:  Author: kolusuLocation: San Jose PostPosted: Thu Oct 16, 2003 4:37 am
    —
Rahul,

I am not sure where you did not find the IBM manual which explains user exits in DFSORT. You can access all DFSORT/ICETOOL right from this site. The first sticky topic in the utilities forum lists all DFSORT/ICETOOL manuals. You can also access them via the main page of mvsforums.

Any ways check this link for User Exit Routine Overview

check this link for Sample COBOL E15 User Exit: Passing or Changing Records for Sort

But I beleive that frank will be coding the E15 exit in Assembler.

Hope this helps...

cheers

kolusu

#7:  Author: Frank YaegerLocation: San Jose PostPosted: Thu Oct 16, 2003 9:58 am
    —
Rahul,

You would have to write the E15 exit yourself in either Assembler or COBOL. An E15 exit receives each SORTIN record from DFSORT, manipulates it as needed, and passes it back to DFSORT. In your case, you would have the E15 identify each Header record, save the fields you need from it, and pass it back to DFSORT unchanged. Then for each subsequent record (until the next Header), you would move the saved fields into the data record and pass the changed record back to DFSORT.

For complete information on DFSORT's exit routines (with examples), see:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICECA109/4.0?DT=20020722140254

You can access all of the DFSORT books online from:

http://www.storage.ibm.com/software/sort/mvs/srtmpub.html

#8:  Author: Rahul Bansal PostPosted: Fri Oct 17, 2003 6:57 am
    —
Hi,

I am trying to code the Cobol user exit routine.

It will be great if u could please send the sample JCL..

How to execute that COBOL user exit routine ?

Thanks
Rahul

#9:  Author: kolusuLocation: San Jose PostPosted: Fri Oct 17, 2003 7:58 am
    —
Rahul,

You need a MODS control statement along with your sort control cards.check this link for a detailed explanation of MODS control statement

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICECA109/3.10?DT=20020722140254

check this link for JCL examples involving exits

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICECA109/10.5.7?SHELF=&DT=20020722140254

Hope this helps...

cheers

kolusu

#10:  Author: Rahul Bansal PostPosted: Mon Oct 20, 2003 5:16 am
    —
Thanks..

I need ur guidance for the problem given below ::

I have a flat file which is having the header and footer record & another file with the detail part.

Header record ::(File 1)
HY xxxxxxxxx T44010 DRCDR1

Footer record :: (File 2)
FY xxxxxxxxx T44010 DRCDR1

Detail records :: (File 1)
12323434+99 DRCDR1 T44010

The problem is to make a combine file having header,detail and footer.
1) File 1 can have any number of header and footer. Output file involve only those header and footer..whose detail record is present.
2) Org(T44010) and Form name(DRCDR1) is unique for each header,footer & Detail record.

Is it possible by SORT ? I know how to do the same using Easytreive or Cobol.

Thanks
Rahul

#11:  Author: kolusuLocation: San Jose PostPosted: Mon Oct 20, 2003 5:23 am
    —
Rahul Bansal,

what is the max no: of records in the header file?? If they are less than 1000 then we can generate include statements and get a common file.For that we need the LRECL, RECFM position of Org(T44010) and Form name(DRCDR1).

Thanks

Kolusu

#12:  Author: Rahul Bansal PostPosted: Mon Oct 20, 2003 6:19 am
    —
Hi Kolusu,

The maximum number of records will be less than 1000.
Lrecl :: 80
Recfm :: FB
Position of ORG(Detail Record) :: 56
Postion of Form Name (Detail Record):: 33

But the position in the Header and Footer ::
Lrecl :: 80
Recfm :: FB
Position of ORG(Detail Record) :: 33
Postion of Form Name (Detail Record):: 42

Thanks

#13:  Author: coolmanLocation: US PostPosted: Mon Oct 20, 2003 7:35 am
    —
Kolusu,

Would SPLICE not be the best way to do it ?

Cheers,
Coolman
________
medical marijuana states


Last edited by coolman on Sat Feb 05, 2011 1:32 am; edited 1 time in total

#14:  Author: kolusuLocation: San Jose PostPosted: Mon Oct 20, 2003 7:58 am
    —
Rahul,

The following DFSORT/ICETOOL JCl will give you the desired results.A brief explanation of the JOb. If you have syncsort at your shop then change the pgm name to synctool.

The first copy operator takes in the detail record file and creates a control card for the header/footer file as follows.
Code:

 INCLUDE COND=(33,6,CH,EQ,C'T44010',AND,42,6,CH,EQ,C'DRCDR1') 
 OUTFIL FNAMES=H1,INCLUDE=(1,2,CH,EQ,C'HY')                   
 OUTFIL FNAMES=F1,INCLUDE=(1,2,CH,EQ,C'FY')                   


The above created control card is then used in second copy step to filter the header and footer records for that particular org and form into 2 different files , File H1 to to have the header record and file F1 to have the footer record.

Once we have these 2 files concat the files in this order.Header file(H1), your detailed record file and finally your Footer file(F1)

The third copy will take in these concatenated files and create one output file

Code:

//STEP0100 EXEC PGM=ICETOOL                                 
//TOOLMSG   DD SYSOUT=*                                       
//DFSMSG    DD SYSOUT=*                                       
//IN1       DD DSN=YOUR DETAIL RECORD FILE,
//             DISP=SHR
//IN2       DD DSN=YOUR HEADER/FOOTER FILE,
//             DISP=SHR
//H1        DD DSN=&H1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE) 
//F1        DD DSN=&F1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
//CON       DD DSN=&H1,DISP=OLD,VOL=REF=*.H1
//          DD DSN=YOUR DETAIL RECORD FILE,DISP=SHR
//          DD DSN=&F1,DISP=OLD,VOL=REF=*.F1
//OUT       DD DSN=YOUR OUTPUT FILE,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,
//             SPACE=(CYL,(X,Y),RLSE)
//TOOLIN    DD *                                         
  COPY FROM(IN1) USING(CTL1)                             
  COPY FROM(IN2) USING(CTL2)                             
  COPY FROM(CON) TO(OUT)                                 
//CTL1CNTL DD *                                           
  OUTFIL FNAMES=CTL2CNTL,ENDREC=1,                       
  OUTREC=(C' INCLUDE COND=(33,6,CH,EQ,C',X'7D',56,6,X'7D',
          C',AND,42,6,CH,EQ,C',X'7D',33,6,X'7D',C')',/,   
          C' OUTFIL FNAMES=H1,INCLUDE=(1,2,CH,EQ,C',X'7D',
          C'HY',X'7D',C')',/,                             
          C' OUTFIL FNAMES=F1,INCLUDE=(1,2,CH,EQ,C',X'7D',
          C'FY',X'7D',C')',80:X)                         
//CTL2CNTL  DD DSN=&C1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
//*


Hope this helps...

cheers

kolusu

#15:  Author: kolusuLocation: San Jose PostPosted: Mon Oct 20, 2003 8:00 am
    —
coolman,

I am not really sure if SPLICE would solve the above mentioned problem. Moreover my shop has only syncsort and they hadn't yet come up with the copy cat version of splice operator. Moreover my knowledge on SPLICE is purely theortical.I just don't wanna suggest a solution which I cannot test.

As such I prefer a standard solution to a solution involving the latest features. The latest features may or may not be available at every shop even though the features are free and can be installed very easily. But somehow the system programmers don't have time to apply all these new PTF'S.

I bet frank will show us if it is possible with SPLICE. He is on west coast and it will be another 2 hours for him to start his work.

Kolusu



MVSFORUMS.com -> Utilities


output generated using printer-friendly topic mod. All times are GMT - 5 Hours

Goto page 1, 2  Next  :| |:
Page 1 of 2

Powered by phpBB © 2001, 2005 phpBB Group