Seperate line and merging



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Seperate line and merging

Postby Varun Dhawan » Tue May 21, 2013 5:57 pm

Hi all,

Thank you for having me here. I have been referring to this and its parent forum ibmmainframe.com for quite a while. It has gotten me through many of my MF queries.

This time around, my query is somewhat peculiar in nature. Please note that i can do this via COBOL but my intention is to do this via SORT.

INPUT FILE - (80 bytes/FB)
----+----1----+----2----+----3----+--
.³  XXX                20130520ABLO 


OUTPUT FILE - (80 bytes/FB)
----+----1----+----2----+----3----+----4----+----5----+----6---
 SIGNON                                                       
 SUBMIT PROC=MAPPLE                       -   
        NEWNAME=XABCD                      -           
        CASE=YES                                          -   
        &MAINDSN='XXXX.TOTAL'                     -
        &NETPATH='\\AB\\CD\      ||    -   
                 \\\IT\\PROD\      ||    -   
                 \\\POL\'\                    -   
        &NETFILE="POLCOUNT_20130520"               -   
        &EXT=".DAT"                                           
 SIGNOFF                                                       


All the lines in my output have to be hardcoded except this one '&NETFILE="POLCOUNT_<DATE>" where i want the '<DATE>' extracted from the input file and it has to be appended after the '_' sign. Can someone please assist me with this.

NOTE: the output files has some '-' signs which is required too and the first line in both files are column header for your reference. They are not required in the output file.

Regards
Varun
Varun Dhawan
 
Posts: 5
Joined: Tue May 21, 2013 5:38 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Seperate line and merging

Postby BillyBoyo » Tue May 21, 2013 6:25 pm

Is the data fixed in format? IE is POLCOUNT_ always going to be in the same starting position?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Seperate line and merging

Postby Varun Dhawan » Tue May 21, 2013 8:47 pm

Yes it will be at the exact same position. The only thing that will change is what comes after POLCOUNT_ which is date that will always be at the same positions in the input file.
Varun Dhawan
 
Posts: 5
Joined: Tue May 21, 2013 5:38 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Seperate line and merging

Postby NicC » Wed May 22, 2013 1:24 am

If you are doing it using sort why are you posting in the JCL section when there are 2 perfectly good sort forums - one for DFsort and one for Syncsort. Moving to DFSort. If you use Syncsort then say so and it will be moved there.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Seperate line and merging

Postby BillyBoyo » Wed May 22, 2013 4:59 am

You need one small step which reads your date file and generates a symbol/SYMNAME for the date.

Have a look at this, http://ibmmainframes.com/about58490.html#294618, for how to turn the date into a symbol on the SYMNAMES file for the second step.

In the second step, process your file with OPTION COPY.

Use INREC with IFTHEN=(WHEN=(condition to identify POLCOUNT_, and overwrite what follow with your generated symbol which will equate to the value of the date from your date file.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Seperate line and merging

Postby Varun Dhawan » Wed May 22, 2013 3:42 pm

NicC, sorry didn't see the Sort forum in a a hurry. I will keep that in mind going forward.

BillyBoyo, thanks for your help. I have pasted the code below so that others can refer to it if required.

//STEP010  EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD DSN=VARUN.DATE,                         
//         DISP=SHR                                       
//SORTOUT  DD DSN=&&DTE,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)
//SYSIN    DD *                                           
  OPTION COPY,STOPAFT=1                                   
  OUTFIL REMOVECC,NODETAIL,BUILD=(80X),                   
  HEADER1=('DTE,C''',24,8,C'''')                           
/*
//*                                                       
//STEP0200 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SYMNAMES DD DSN=&&DTE,DISP=(OLD,PASS)                   
//SORTIN   DD DSN=INPUT.PS,               
//         DISP=SHR                                       
//SORTOUT  DD DSN=OUTPUT.PS,               
//         DISP=SHR                                       
//SYSIN    DD *                                           
   OPTION COPY                                   
     INREC IFTHEN=(WHEN=(32,8,CH,EQ,C'YYYYMMDD'),
                OVERLAY=(32:DTE))                 
/*                                               
//*                                             


Thanks once again.

Regards
Varun Dhawan
Varun Dhawan
 
Posts: 5
Joined: Tue May 21, 2013 5:38 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Seperate line and merging

Postby Varun Dhawan » Thu May 23, 2013 1:16 am

One more thing, can someone help me explain this line HEADER1=('DTE,C''',24,8,C'''') especially the single inverted commas, I dont understand the significance. Any help as time permits is appreciated.
Varun Dhawan
 
Posts: 5
Joined: Tue May 21, 2013 5:38 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Seperate line and merging

Postby BillyBoyo » Thu May 23, 2013 11:58 am

 HEADER1=('DTE,C''',24,8,C'''')


If you change SORTOUT to a SYSOUT rather than a dataset, you'll be able to more conveniently experiment.

HEADER1=('DTE,C''',/,
         24,8,/,
         C'''')


What the slash-operator (the "/") does is say "that's the end of one output record", so allows multiple output records from the same input record.

If you use the above code in place of the existing HEADER1, you'll get three output records:

DTE,C'
the-date-from-your-input
'


For the symbol you need to have it bounded with 's. 's of course mean something in SORT Control Cards. So to get a ' in the output from a literal, you, like any language, have to "do something". As is common on the Mainframe, this is to "double them up". '' will get you one ' in the output.

If you notice, there are four 's in each of the two lines with 's that I have shown. The left-most and right-most are to define a literal, the two in the middle, always consecutive, will be turned into one ' in the output.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Seperate line and merging

Postby Varun Dhawan » Wed May 29, 2013 12:13 pm

I apologise for the late reply, was out of town. Thanks for the explanation BillyBoyo. You rock :D
Varun Dhawan
 
Posts: 5
Joined: Tue May 21, 2013 5:38 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post