IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

DFSORT logic problem


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Mon Dec 13, 2010 2:16 pm
Reply with quote

thanks a lot Hariharan, I am grateful to you for your help icon_smile.gif i ll test this jcl and get back to you..icon_smile.gif
Back to top
View user's profile Send private message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Mon Dec 13, 2010 2:48 pm
Reply with quote

u have used sum fields to add up and bring the output in single line.but in my case i have ZD, as well as charecter fields,

ex:

0102031050006618 2010-12-11Y 12AB
0102031050006618 2010-12-11Y 13CD
0102031050006618 2010-12-11Y 14DE

And my output should be

0102031050006618 2010-12-11Y 12AB13CD14DE

DO WE HAVE ANYOTHER METHOD TO BRING THE OUTPUT IN SINGLE LINE?
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Dec 13, 2010 11:02 pm
Reply with quote

useit,

You are just wasting your time. Provide the following details.

1. What is the cobol layout of input and output file. I need the definition and format of the fields involved to be merged.

2. Answer frank's question about the final output here

ibmmainframes.com/viewtopic.php?p=256827#256827


Hariharan Ramachandran,

I know you are eager to help , but please understand the question first and then try to answer and please do NOT complicate a simple requirement.
Back to top
View user's profile Send private message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Tue Dec 14, 2010 10:50 am
Reply with quote

skolusu/hari/frank,
please find the below details


input layout(input lrecl=82)

01 input rec.
05 key data pic x(12).
05 value 1 pic s9(2) v (99) comp-3.
05 value 2 pic s9(2) v (99) comp-3.
05 value 3 pic s9(2) v (99) comp-3.
05 filler pic x(58).

input file:

012010X..............................................
012010Y+10.00+38.00+14.93
012010Y+18.00+30.00+14.09
012010Y+10.00+20.00+15.94
012010Y+20.00+10.00+17.67
012010Y+10.00+10.00+17.36
012010Y+20.00+30.00+47.36
012010Y+40.00+10.00+17.36
012010X..............................................
012010Y+10.00+20.00+15.94
012010Y+10.00+10.00+17.36


output layout:(input lrecl=48)

01 outputrec.
05 key data pic x(12).
05 value 1a pic s9(2) v (99) comp-3.
05 value 2a pic s9(2) v (99) comp-3.
05 value 3a pic s9(2) v (99) comp-3.
05 value 1b pic s9(2) v (99) comp-3.
05 value 2b pic s9(2) v (99) comp-3.
05 value 3b pic s9(2) v (99) comp-3.
05 value 1c pic s9(2) v (99) comp-3.
05 value 2c pic s9(2) v (99) comp-3.
05 value 3c pic s9(2) v (99) comp-3.



output file should be:

012010X..............................................
012010Y+10.00+38.00+14.93+18.00+30.00+14.09+10.00+20.00+15.94
..............+20.00+10.00+17.67+10.00+10.00+17.36+20.00+30.00+47.36
..............+40.00+10.00+17.36
012010X..............................................
012010Y+10.00+20.00+15.94+10.00+10.00+17.36


treat "............" as spaces

regards,
useit
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Dec 14, 2010 11:15 am
Reply with quote

Hello,

Suggest you review what you have posted and correct or clarify. . .

The input record layout does not appear to be length 82. . .

The input data has no packed-decimal fields, but the layout shows 3 fields that are packed-decimal (comp-3).

You need to post the "rules" you want folllowed also. . .
Back to top
View user's profile Send private message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Tue Dec 14, 2010 12:09 pm
Reply with quote

apologies,

its not s9(2) v (99) comp-3. its s9(5) v (99) comp-3.
Back to top
View user's profile Send private message
giraffe

New User


Joined: 09 Nov 2010
Posts: 27
Location: SHENZHEN CHINA

PostPosted: Tue Dec 14, 2010 7:04 pm
Reply with quote

WHAT ABOUT THE MAX NUMBER OF Y TYPE RECORDS FOR EACH GROUP, I THINK WE CAN USE 'WHEN=GROUP' FEATURE AND SPLICE TOOL TO RESOLVE THIS PROBLEM.
Back to top
View user's profile Send private message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Tue Dec 14, 2010 8:09 pm
Reply with quote

under EACH X TYPE WE CAN HAVE 15 Y TYPE RECORDS(MAX).BUT IT MAY VARY.

EVEN I HEARD IT CAN BE ACHIEVED THRU WHEN=GROUP AND PUSH COMMAND.(ICETOOL IS NOT PREFERRED IN OUR COMPANY.I HAVE TO USE ONLY DFSORT) CAN SOMEONE PROVIDE ME THE SOLUTION? PLEASE HELP ME REGARDING THE SAME. PLZZZZZZ DONT FORGET
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Dec 14, 2010 10:44 pm
Reply with quote

Hello,

PLEASE TURN YOUR CAPS OFF. . .

Quote:
its not s9(2) v (99) comp-3. its s9(5) v (99) comp-3.
Ok, but what about:
Quote:
The input data has no packed-decimal fields, but the layout shows 3 fields that are packed-decimal (comp-3).

None of this is packed-decimal:
Code:
012010X..............................................
012010Y+10.00+38.00+14.93
012010Y+18.00+30.00+14.09
012010Y+10.00+20.00+15.94
012010Y+20.00+10.00+17.67
012010Y+10.00+10.00+17.36
012010Y+20.00+30.00+47.36
012010Y+40.00+10.00+17.36
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Dec 15, 2010 12:32 am
Reply with quote

Useit,

You change your requirements as you please , it is really tough to provide solutions to a moving target. The following are my assumptions.

1. You have records with a header followed by detail records.
2. The header record is denoted by X in pos 12 and is always the first record within the group.
3. The Detail records have 3 packed decimal fields each with a length of 4 bytes starting in position 13.
4. The output is FB and lrecl of 48.

Use the following DFSORT JCL
Code:

//STEP0100 EXEC PGM=SORT         
//SYSOUT   DD SYSOUT=*           
//SORTIN   DD DSN=your input FB 82 Lrecl file,
//SORTOUT  DD SYSOUT=*           
//SYSIN    DD *                                                     
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,12,9X'0000000C',13,12,72:X'1C')),
  IFTHEN=(WHEN=GROUP,BEGIN=(12,1,CH,EQ,C'X'),                       
  PUSH=(61:ID=8,70:SEQ=2)),                                         

  IFTHEN=(WHEN=(70,2,ZD,EQ,02),OVERLAY=(13:49,12,69:C'A')),         
  IFTHEN=(WHEN=(70,2,ZD,EQ,03),OVERLAY=(25:49,12,69:C'A')),         
  IFTHEN=(WHEN=(70,2,ZD,EQ,04),OVERLAY=(37:49,12,69:C'A')), 
       
  IFTHEN=(WHEN=(70,2,ZD,EQ,05),                                     
  BUILD=(12X,49,12,25,24,61:61,8,69:C'B',70,3)),                     
  IFTHEN=(WHEN=(70,2,ZD,EQ,06),                                     
  BUILD=(12X,13,12,49,12,37,12,61:61,8,69:C'B',70,3)),               
  IFTHEN=(WHEN=(70,2,ZD,EQ,07),                                     
  BUILD=(12X,13,24,49,12,61:61,8,69:C'B',70,3)),                     
                                                                     
  IFTHEN=(WHEN=(70,2,ZD,EQ,08),                                     
  BUILD=(12X,49,12,25,24,61:61,8,69:C'C',70,3)),                     
  IFTHEN=(WHEN=(70,2,ZD,EQ,09),                                     
  BUILD=(12X,13,12,49,12,37,12,61:61,8,69:C'C',70,3)),               
  IFTHEN=(WHEN=(70,2,ZD,EQ,10),                                     
  BUILD=(12X,13,24,49,12,61:61,8,69:C'C',70,3)),                     
                                                                     
  IFTHEN=(WHEN=(70,2,ZD,EQ,10),                                     
  BUILD=(12X,49,12,25,24,61:61,8,69:C'D',70,3)),                     
  IFTHEN=(WHEN=(70,2,ZD,EQ,11),                                     
  BUILD=(12X,13,12,49,12,37,12,61:61,8,69:C'D',70,3)),               
  IFTHEN=(WHEN=(70,2,ZD,EQ,12),                                     
  BUILD=(12X,13,24,49,12,61:61,8,69:C'D',70,3)),                     
                                                                     
  IFTHEN=(WHEN=(70,2,ZD,EQ,13),                                     
  BUILD=(12X,49,12,25,24,61:61,8,69:C'D',70,3)),                     
  IFTHEN=(WHEN=(70,2,ZD,EQ,14),                                     
  BUILD=(12X,13,12,49,12,37,12,61:61,8,69:C'D',70,3)),               
  IFTHEN=(WHEN=(70,2,ZD,EQ,15),                                     
  BUILD=(12X,13,24,49,12,61:61,8,69:C'D',70,3)),                     
                                                                     
  IFTHEN=(WHEN=(70,2,ZD,EQ,16),                                     
  BUILD=(12X,49,12,25,24,61:61,8,69:C'E',70,3))                     
                                                                     
  SORT FIELDS=(61,9,CH,A),EQUALS                                     
  SUM FIELDS=(13,4,17,4,21,4,25,4,29,4,33,4,           
              37,4,41,4,45,4,72,1),FORMAT=PD           
                                                       
  OUTREC IFOUTLEN=48,                                 
  IFTHEN=(WHEN=(12,1,CH,EQ,C'X'),OVERLAY=(13:36X)),   
  IFTHEN=(WHEN=(72,1,PD,EQ,1),OVERLAY=(25:24X)),       
  IFTHEN=(WHEN=(72,1,PD,EQ,2),OVERLAY=(36:12X))       
//*
Back to top
View user's profile Send private message
giraffe

New User


Joined: 09 Nov 2010
Posts: 27
Location: SHENZHEN CHINA

PostPosted: Wed Dec 15, 2010 8:54 am
Reply with quote

Hi, dude, what about my code posted below.

Code:
//SORTDATA EXEC PGM=ICETOOL,COND=(8,LT)                                 
//SYSPRINT DD   SYSOUT=*                                               
//SYSOUT   DD   SYSOUT=*                                               
//SYSDBOUT DD   SYSOUT=*                                               
//DFSMSG   DD   SYSOUT=*                                               
//TOOLMSG  DD   SYSOUT=*                                               
//INPUT    DD   *                                                       
0102031050006618 2010-12-10X 10.00.00############555555555FFFFFFFFFFFFFF
0102031050006618 2010-12-11Y 10.00.00                                   
0102031050006618 2010-12-12Y 20.00.00                                   
0102031050006618 2010-12-13Y 30.00.00                                   
0102031050006618 2010-12-14Y 40.00.00                                   
0102031050006618 2010-12-15Y 50.00.00                                   
0102031050006618 2010-12-16Y 60.00.00                                   
0102031050006666 2010-12-10X 11.00.00############555555555FFFFFFFFFFFFFF
0102031050006666 2010-12-11Y 12.00.00                                   
0102031050006666 2010-12-12Y 13.00.00                                   
0102031050006666 2010-12-13Y 14.00.00                                   
0102031050006666 2010-12-14Y 15.00.00                                   
/*                                                                     
//DD1      DD   DSN=GIRAFFE.SORTDAT1.SEQF.SORT025J,                     
//         DISP=(NEW,CATLG,DELETE),                                     
//         UNIT=SYSDA,                                                 
//         SPACE=(TRK,(1,1),RLSE),                                     
//         DCB=(LRECL=80,RECFM=FB,DSORG=PS)                             
//DD2      DD   DSN=GIRAFFE.SORTDAT2.SEQF.SORT025J,                     
//         DISP=(NEW,CATLG,DELETE),                                     
//         UNIT=SYSDA,                                                 
//         SPACE=(TRK,(1,1),RLSE),                                     
//         DCB=(LRECL=80,RECFM=FB,DSORG=PS)                             
//DD3      DD   DSN=GIRAFFE.SORTDAT3.SEQF.SORT025J,                     
//         DISP=(NEW,CATLG,DELETE),                                     
//         UNIT=SYSDA,                                                 
//         SPACE=(TRK,(1,1),RLSE),                                     
//         DCB=(LRECL=80,RECFM=FB,DSORG=PS)                             
//TOOLIN   DD   *                                                       
  COPY     FROM(INPUT)   TO(DD1)       -                               
           USING(CPY1)                                                 
                                                                       
  SPLICE   FROM(DD1)     TO(DD2)       -                               
           ON(28,1,CH)   ON(80,1,ZD)   -                               
           WITH(30,8)    WITH(38,8)    -                               
           WITH(46,8)    WITH(54,8)    -                               
           WITH(62,8)    WITH(70,8)    -                               
           WITHANY       KEEPNODUPS                                     
                                                                       
  SORT     FROM(DD2)     TO(DD3)       -                               
           USING(SRT1)                                                 
/*                 
//CPY1CNTL DD   *                             
  SORT     FIELDS=COPY                         
                                               
  OUTREC   IFTHEN=(WHEN=GROUP,                 
                   BEGIN=(28,1,CH,EQ,C'X'),   
                   PUSH=(80:ID=1,79:SEQ=1)),   
           IFTHEN=(WHEN=(79,1,ZD,EQ,3),       
                   OVERLAY=(38:30,8,30:8X)),   
           IFTHEN=(WHEN=(79,1,ZD,EQ,4),       
                   OVERLAY=(46:30,8,30:16X)), 
           IFTHEN=(WHEN=(79,1,ZD,EQ,5),       
                   OVERLAY=(54:30,8,30:24X)), 
           IFTHEN=(WHEN=(79,1,ZD,EQ,6),       
                   OVERLAY=(62:30,8,30:32X)), 
           IFTHEN=(WHEN=(79,1,ZD,EQ,7),       
                   OVERLAY=(70:30,8,30:40X))   
/*                                             
//SRT1CNTL DD   *           
  SORT     FIELDS=(1,27,CH,A)
  OUTREC   OVERLAY=(79:2X)   
/*                     
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Dec 15, 2010 9:03 am
Reply with quote

Hello,

Why did you ignore the "rule" that ICETOOL use is not permitted at this organization. . . icon_confused.gif
Back to top
View user's profile Send private message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Wed Dec 15, 2010 2:33 pm
Reply with quote

i shouldnt use icetool so:( stiil thanks a lot for your help..skolusu i havent tested the code yet i ll get back to you soon:) am very thankful to you:)
Back to top
View user's profile Send private message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Wed Dec 15, 2010 6:28 pm
Reply with quote

skolosu,
so sorry for bothering you.i have tested this jcl but only header record writtten to output.

output:
012010-10-10.

your asssumption are almost correct. except the last one.

The header record is denoted by X in pos 7(Not in 12).let me know if u need any other information.

thanks a lot for your help. am sorry i have taken much of your time:(
Back to top
View user's profile Send private message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Wed Dec 15, 2010 6:42 pm
Reply with quote

The header record is denoted by X in pos 7 and detail record by 'Y' in pos 7 and The Detail records have 3 packed decimal fields each with a length of 4 bytes starting in position 8
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Dec 16, 2010 12:02 am
Reply with quote

useit wrote:
The header record is denoted by X in pos 7 and detail record by 'Y' in pos 7 and The Detail records have 3 packed decimal fields each with a length of 4 bytes starting in position 8


useit wrote:

01 input rec.
05 key data pic x(12).
05 value 1 pic s9(2) v (99) comp-3.
05 value 2 pic s9(2) v (99) comp-3.
05 value 3 pic s9(2) v (99) comp-3.
05 filler pic x(58).


useit,

Your description does NOT make any sense. Earlier you said that your keydata is first 12 bytes. How can the detail records have the Packed decimal fields in pos 8? Did you show me the layout of the header record and is there a different layout for detail records? Please provide complete details if you need any help from me.

useit wrote:
skolosu, so sorry for bothering you.


I would appreciate if you can at least spell my name correctly.
Back to top
View user's profile Send private message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Thu Dec 16, 2010 9:39 am
Reply with quote

Dear skolusu,

please find thebelow examples(i have provided the complete details with another example). do take a look and let me know incase of any concerns.

NPUT FILE LRECL= (35), OUTPUT LRECL= (49), KEY=(1-23)


INPUT LAYOUT:
-----------------------------------------------------------------------------------
01 HDR-REC.
03 DATE PIC X(10).
03 REC-TYPE PIC 9.
03 FILLER PIC X(24).
01 DETAIL-REC.
03 DATE PIC X(10).
03 REC-TYPE PIC 9.
03 STORE NO PIC S9(5) COMP-3.
03 PRODUCT-NO PIC S9(9) COMP-3.
03 ORDER-TYPE PIC X.
03 REC-TYPE PIC S9 COMP-3.
03 DAY-NO PIC S9(4) COMP.
03 STK-EXPIRE PIC S9(5)V99 COMP-3.
03 SOH PIC S9(5)V99 COMP-3.
03 SALES PIC S9(5)V99 COMP-3.
------------------------------------------------------------------------------------------

OUTPUT FILE LAYOUT
------------------------------------------------------------------------------------------
01 HDR-REC.
03 DATE PIC X(10).
03 REC-TYPE PIC 9.
03 FILLER PIC X(30).
01 DETAIL-REC.
03 DATE PIC X(10).
03 REC-TYPE PIC 9.
03 STORE NO PIC S9(5) COMP-3.
03 PRODUCT-NO PIC S9(9) COMP-3.
03 ORDER-TYPE PIC X.
03 REC-TYPE PIC S9 COMP-3.
03 DAY-NO PIC S9(4) COMP.
03 STK-EXPIRE1 PIC S9(5)V99 COMP-3.
03 SOH1 PIC S9(5)V99 COMP-3.
03 SALES1 PIC S9(5)V99 COMP-3.
03 STK-EXPIRE2 PIC S9(5)V99 COMP-3.
03 SOH2 PIC S9(5)V99 COMP-3.
03 SALES2 PIC S9(5)V99 COMP-3.
03 STK-EXPIRE2 PIC S9(5)V99 COMP-3.
03 SOH2 PIC S9(5)V99 COMP-3.
03 SALES2 PIC S9(5)V99 COMP-3.

------------------------------------------------------------------------------------------------------

INPUTFILE;
------------------------------------------------------------------------------------------------------
200-10-10X
KEY1+10.00+71.00+40.00
KEY1+20.00+51.00+20.00
KEY1+20.00+41.00+10.00
KEY1+30.00+11.00+30.00
KEY1+40.00+31.00+20.00
200-10-11X
KEY2+10.00+41.00+10.00
KEY2+20.00+31.00+80.00
200-10-12X
KEY3+10.00+71.00+40.00
KEY3+20.00+51.00+20.00
KEY3+20.00+41.00+10.00
KEY3+30.00+11.00+30.00



-----------------------------------------------------------------------------------------------------
OUTPUT FILE:
----------------------------------------------------------------------------------------------------
200-10-10X
KEY1+10.00+71.00+40.00+20.00+51.00+20.00+20.00+41.00+10.00
........+30.00+11.00+30.00+40.00+31.00+20.00
200-10-11X
KEY2+10.00+41.00+10.00+20.00+31.00+80.00
200-10-12X
KEY3+10.00+71.00+40.00+20.00+51.00+20.00+20.00+41.00+10.00
........+30.00+11.00+30.00
-----------------------------------------------------------------------------------------------------

treat '........' as spaces
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Dec 17, 2010 12:36 am
Reply with quote

useit wrote:
NPUT FILE LRECL= (35), OUTPUT LRECL= (49), KEY=(1-23). do take a look and let me know incase of any concerns


Useit,

yep I do have concerns. How many times do you plan to change the requirements? Did you mean Output LRECL as 59? as your output layout accounts to 59 bytes. You haven't explained as to how you want the rows to split. How did you end up populating REC-TYPE with X and Y which is defined as PIC 9.?
Back to top
View user's profile Send private message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Fri Dec 17, 2010 9:11 am
Reply with quote

skolusu,

Thank you so very much for all your help.

sorry what you said is right.my output LRECL=59, AND THE REC-TYPE IS PIC X.(sory its not pic 9).and key position -1-23,i want the rows to be split as below.


input file:
200-10-10X
KEY1+10.00+71.00+40.00
KEY1+20.00+51.00+20.00
KEY1+20.00+41.00+10.00
200-10-11X
KEY2+10.00+41.00+10.00
KEY2+20.00+31.00+80.00
KEY2+11.00+71.00+41.00
KEY2+20.00+51.00+20.00
KEY2+20.00+41.00+10.00
200-10-12X
KEY3+10.00+71.00+40.00
KEY3+20.00+51.00+20.00
KEY3+20.00+41.00+10.00
KEY3+30.00+11.00+30.00


1) under first header we have 3 detail records.

if there are 3 "Y" Type Records under first header then:

1-35---first detail record
i,e : KEY1+10.00+71.00+40.00
36-47-data from 23rd to 12th position of second detail record
i,e : +20.00+51.00+20.00
48-59- data from 23rd to 12th position of third detail record
i,e : +20.00+41.00+10.00

2) under second header(200-10-11X) we have 5 Y type records.

If ther are 5 Y type records under second header:

1-35---first detail record(first y type record under second header)
i,e: KEY2+10.00+41.00+10.00
36-47-data from 23rd to 12th position of second detail record
i,e: +20.00+31.00+80.00
48-59- data from 23rd to 12th position of third detail record
i,e : +11.00+71.00+41.00
in next line
1-23-spaces
24-35 -data from 23rd to 12th position of fourth detail record
i,e: +20.00+51.00+20.00
36-47- data from 23rd to 12th position of fifth detail record
i, e: +20.00+41.00+10.00
48-59- spaces

(we can hold only 59 bytes in single line.so after 59 data will overflow.so we have to write remaining records in next line as mentioned above)

3) under third header(200-10-12X) we have 4 Y type records.

If ther are 4 Y type records under second header:

1-35---first detail record(first y type record under second header)
i,e: KEY3+10.00+71.00+40.00
36-47-data from 23rd to 12th position of second detail record
i,e:+20.00+51.00+20.00
48-59- data from 23rd to 12th position of third detail record
i,e :+41.00+10.00
in next line
1-23-spaces
24-35 -data from 23rd to 12th position of fourth detail record
i,e: +30.00+11.00+30.00

so in this case my final output will be.

200-10-10X
KEY1+10.00+71.00+40.00+20.00+51.00+20.00+20.00+41.00+10.00
200-10-11X
KEY2+10.00+41.00+10.00+20.00+31.00+80.00+11.00+71.00+41.00
........+20.00+51.00+20.00+20.00+41.00+10.00
200-10-12X
KEY3+10.00+71.00+40.00+20.00+51.00+20.00+20.00+41.00+10.00
........+30.00+11.00+30.00


Note:under each header("x") we can have maximum 15 "Y" type record. but it ll vary from (1 to 15) not fixed.

Once again, thank you very much for taking your time to look at this issue. waiting for ur reply:)
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Sat Dec 18, 2010 2:33 am
Reply with quote

useit,

The following DFSORT JCL will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT           
//SYSOUT   DD SYSOUT=*             
//SORTIN   DD DSN=Your input Fb 35 byte file,DISP=SHR
//SORTOUT  DD SYSOUT=*             
//SYSIN    DD *                     
                                                                 
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,23,9X'0000000C',24,12,X'1C')),
  IFTHEN=(WHEN=GROUP,BEGIN=(11,1,CH,EQ,C'X'),                     
  PUSH=(73:ID=8,82:SEQ=2)),                                       
  IFTHEN=(WHEN=(82,2,ZD,EQ,02),OVERLAY=(24:60,12,81:C'A')),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,03),OVERLAY=(36:60,12,81:C'A')),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,04),OVERLAY=(48:60,12,81:C'A')),       
                                                                 
  IFTHEN=(WHEN=(82,2,ZD,EQ,05),OVERLAY=(23X,60,12,81:C'B')),     
  IFTHEN=(WHEN=(82,2,ZD,EQ,06),OVERLAY=(23X,36:60,12,81:C'B')),   
  IFTHEN=(WHEN=(82,2,ZD,EQ,07),OVERLAY=(23X,48:60,12,81:C'B')),   
                                                                 
  IFTHEN=(WHEN=(82,2,ZD,EQ,08),OVERLAY=(23X,60,12,81:C'C')),     
  IFTHEN=(WHEN=(82,2,ZD,EQ,09),OVERLAY=(23X,36:60,12,81:C'C')),   
  IFTHEN=(WHEN=(82,2,ZD,EQ,10),OVERLAY=(23X,48:60,12,81:C'C')),   
                                                                 
  IFTHEN=(WHEN=(82,2,ZD,EQ,11),OVERLAY=(23X,60,12,81:C'D')),     
  IFTHEN=(WHEN=(82,2,ZD,EQ,12),OVERLAY=(23X,36:60,12,81:C'D')),   
  IFTHEN=(WHEN=(82,2,ZD,EQ,13),OVERLAY=(23X,48:60,12,81:C'D')),   
                                                                 
  IFTHEN=(WHEN=(82,2,ZD,EQ,14),OVERLAY=(23X,60,12,81:C'E')),     
  IFTHEN=(WHEN=(82,2,ZD,EQ,15),OVERLAY=(23X,36:60,12,81:C'E')),   
  IFTHEN=(WHEN=(82,2,ZD,EQ,16),OVERLAY=(23X,48:60,12,81:C'E'))   
                                                                 
  SORT FIELDS=(73,9,CH,A),EQUALS                                 
                                                                 
  SUM FIELDS=(24,4,28,4,32,4,36,4,40,4,44,4,                     
              48,4,52,4,56,4,72,1),FORMAT=PD                     
                                                                 
  OUTREC IFOUTLEN=59,                                             
  IFTHEN=(WHEN=(11,1,CH,EQ,C'X'),OVERLAY=(12:48X)),               
  IFTHEN=(WHEN=(72,1,PD,EQ,1),OVERLAY=(36:24X)),                 
  IFTHEN=(WHEN=(72,1,PD,EQ,2),OVERLAY=(48:12X))                   
                                                                 
//*
Back to top
View user's profile Send private message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Tue Dec 21, 2010 12:03 pm
Reply with quote

skolusu,
i tried this jcl and it is working fine:) Once again my personal thanks for helping me out in quick time...

also please tell me how do u decide the position of sequence number and push id.

ex:PUSH=(73:ID=8,82:SEQ=2)

if my input LRECL=205. AND OUTPUT LRECL=99. what would be my push & seq number position)
Back to top
View user's profile Send private message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Tue Dec 21, 2010 3:33 pm
Reply with quote

hi,


one more similar exam i tried to execute it.but it failed with soc7.
input lrecl=205, output lrecl=99

1-39 key data.


my input layout is as below.

01 REC.
07 KEY-DATA PIC X(39).
07 CALC-DATA.
09 EXPIRE PIC S9(5)V99 COMP-3.
09 SOH PIC S9(5)V99 COMP-3.
09 SALES PIC S9(5)V99 COMP-3.
07 FILLER PIC X(154).

please see the below jcl:

//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=INPUT.FILE,DISP=SHR
//SORTOUT DD DSN=OUTPUT.FILE,DISP=SHR
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,BUILD=(1,39,9X'0000000C',40,12,X'1C')),
IFTHEN=(WHEN=GROUP,BEGIN=(39,1,CH,EQ,C'X'),
PUSH=(113:ID=8,122:SEQ=2)),
IFTHEN=(WHEN=(122,2,ZD,EQ,02),OVERLAY=(40:100,12,121:C'A')),
IFTHEN=(WHEN=(122,2,ZD,EQ,03),OVERLAY=(52:100,12,121:C'A')),
IFTHEN=(WHEN=(122,2,ZD,EQ,04),OVERLAY=(64:100,12,121:C'A')),
IFTHEN=(WHEN=(122,2,ZD,EQ,05),OVERLAY=(76:100,12,121:C'A')),
IFTHEN=(WHEN=(122,2,ZD,EQ,06),OVERLAY=(88:100,12,121:C'A')),
IFTHEN=(WHEN=(122,2,ZD,EQ,07),OVERLAY=(39X,100,12,121:C'B')),
IFTHEN=(WHEN=(122,2,ZD,EQ,08),OVERLAY=(39X,52:100,12,121:C'B')),
IFTHEN=(WHEN=(122,2,ZD,EQ,09),OVERLAY=(39X,64:100,12,121:C'B')),
IFTHEN=(WHEN=(122,2,ZD,EQ,10),OVERLAY=(39X,76:100,12,121:C'B')),
IFTHEN=(WHEN=(122,2,ZD,EQ,11),OVERLAY=(39X,88:100,12,121:C'B')),

IFTHEN=(WHEN=(122,2,ZD,EQ,12),OVERLAY=(39X,100,12,121:C'C')),
IFTHEN=(WHEN=(122,2,ZD,EQ,13),OVERLAY=(39X,52:100,12,121:C'C')),
IFTHEN=(WHEN=(122,2,ZD,EQ,14),OVERLAY=(39X,64:100,12,121:C'C')),
IFTHEN=(WHEN=(122,2,ZD,EQ,15),OVERLAY=(39X,76:100,12,121:C'C')),
IFTHEN=(WHEN=(122,2,ZD,EQ,16),OVERLAY=(39X,88:100,12,121:C'C')),

IFTHEN=(WHEN=(122,2,ZD,EQ,17),OVERLAY=(39X,100,12,121:C'D')),
IFTHEN=(WHEN=(122,2,ZD,EQ,18),OVERLAY=(39X,52:100,12,121:C'D')),
IFTHEN=(WHEN=(122,2,ZD,EQ,19),OVERLAY=(39X,64:100,12,121:C'D')),
IFTHEN=(WHEN=(122,2,ZD,EQ,20),OVERLAY=(39X,76:100,12,121:C'D')),
IFTHEN=(WHEN=(122,2,ZD,EQ,21),OVERLAY=(39X,88:100,12,121:C'D')),

IFTHEN=(WHEN=(122,2,ZD,EQ,22),OVERLAY=(39X,100,12,121:C'E')),
IFTHEN=(WHEN=(122,2,ZD,EQ,23),OVERLAY=(39X,52:100,12,121:C'E')),
IFTHEN=(WHEN=(122,2,ZD,EQ,24),OVERLAY=(39X,64:100,12,121:C'E')),
IFTHEN=(WHEN=(122,2,ZD,EQ,25),OVERLAY=(39X,76:100,12,121:C'E')),
IFTHEN=(WHEN=(122,2,ZD,EQ,26),OVERLAY=(39X,88:100,12,121:C'E')),

IFTHEN=(WHEN=(122,2,ZD,EQ,27),OVERLAY=(39X,100,12,121:C'F')),
IFTHEN=(WHEN=(122,2,ZD,EQ,28),OVERLAY=(39X,52:100,12,121:C'F')),
IFTHEN=(WHEN=(122,2,ZD,EQ,29),OVERLAY=(39X,64:100,12,121:C'F')),
IFTHEN=(WHEN=(122,2,ZD,EQ,30),OVERLAY=(39X,76:100,12,121:C'F')),
IFTHEN=(WHEN=(122,2,ZD,EQ,31),OVERLAY=(39X,88:100,12,121:C'F'))

SORT FIELDS=(113,9,CH,A),EQUALS

SUM FIELDS=(40,4,44,4,48,4,52,4,56,4,60,4,
64,4,68,4,72,4,76,4,80,4,84,4,88,4,92,4,
96,4,112,1),FORMAT=PD
OUTREC IFOUTLEN=99,
IFTHEN=(WHEN=(39,1,CH,EQ,C'X'),OVERLAY=(40:60X)),
IFTHEN=(WHEN=(112,1,PD,EQ,1),OVERLAY=(52:48X)),
IFTHEN=(WHEN=(112,1,PD,EQ,2),OVERLAY=(64:36X)),
IFTHEN=(WHEN=(112,1,PD,EQ,3),OVERLAY=(76:24X)),
IFTHEN=(WHEN=(112,1,PD,EQ,4),OVERLAY=(88:12X))
Back to top
View user's profile Send private message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Tue Dec 21, 2010 5:19 pm
Reply with quote

skolusu,
i got the reason:). its working fine now:) thank you so much
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Dec 21, 2010 10:37 pm
Reply with quote

useit wrote:
hi,
one more similar exam i tried to execute it.but it failed with soc7.
input lrecl=205, output lrecl=99


Woah all these questions are part of an exam and you are getting the answers from here? What happens if the instructor asks you to explain the job?
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Dec 21, 2010 11:53 pm
Reply with quote

Kolusu,

You're always available for the explanation icon_lol.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL Goto page 1, 2, 3  Next

 


Similar Topics
Topic Forum Replies
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
Search our Forums:

Back to Top