|
View previous topic :: View next topic
|
| Author |
Message |
Jasand
New User
Joined: 23 Jan 2009 Posts: 32 Location: Tamil nadu
|
|
|
|
Hi,
Using the below code,
//STEPA EXEC PGM=SORT,REGION=0M
//SORTIN DD DSN=... input file1 (FB/50)
// DD DSN=... input file2 (FB/50)
// DD DSN=... input file3 (FB/50)
//SORTOUT DD DSN=... output file (FB/100)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC BUILD=(23,5,95X)
OUTFIL REMOVECC,
HEADER1=(2/,
'PLEASE FIND THE BELOW DETAILS FOR EACH INDIVIDUAL',
/,5:'AGE',/,
5:'HEIGHT',/,
5:'WEIGHT',/)
/*
I get the ouput as
----------------------------------------------------------------------
PLEASE FIND THE BELOW DETAILS FOR EACH INDIVIDUAL
AGE
HEIGHT
WEIGHT
23
158
45
18
157
47
------------------------------------------------------------------------------
My expected output is
------------------------------------------------------------------------------
PLEASE FIND THE BELOW DETAILS FOR EACH INDIVIDUAL
AGE
HEIGHT
WEIGHT
STUDENT1
---------
23
158
45
STUDENT2
--------
18
157
47
-----------------------------------------------------------------------------
Can someone help me to inser those titles?
Thanks,
Jasand |
|
| Back to top |
|
 |
guptae
Moderator

Joined: 14 Oct 2005 Posts: 1209 Location: Bangalore,India
|
|
|
|
Hello Jasmad,
Would you kindly provide your input as well. I think you have student records in seperate file & you are trying to merge it with header . Please use code option while posting . |
|
| Back to top |
|
 |
Jasand
New User
Joined: 23 Jan 2009 Posts: 32 Location: Tamil nadu
|
|
|
|
Hi Guptae,
Yes, I have the inputs in 3 seperate files
//SORTIN DD DSN=... input file1 (FB/50)
// DD DSN=... input file2 (FB/50)
// DD DSN=... input file3 (FB/50)
| Code: |
***************************** Top of Data ***
AGE : 23
HEIGHT : 158
WEIGHT : 45
**************************** Bottom of Data * |
The above file is for Student1
Similarly there are many input files, one for each student.
Thanks,
Jasand |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You can use a DFSORT job like the following to do what you asked for:
| Code: |
//STEPA EXEC PGM=SORT,REGION=0M
//SORTIN DD DSN=... input file1 (FB/50)
// DD DSN=... input file2 (FB/50)
// DD DSN=... input file3 (FB/50)
//SORTOUT DD DSN=... output file (FB/100)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(23,5)),
IFTHEN=(WHEN=GROUP,RECORDS=3,PUSH=(24:ID=5))
OUTFIL REMOVECC,
HEADER1=(2/,
'PLEASE FIND THE BELOW DETAILS FOR EACH INDIVIDUAL',
/,5:'AGE',/,
5:'HEIGHT',/,
5:'WEIGHT',/),
BUILD=(1,5,100:X),
SECTIONS=(24,5,HEADER3=('STUDENT',24,5,/,'------------'))
/*
|
|
|
| Back to top |
|
 |
Jasand
New User
Joined: 23 Jan 2009 Posts: 32 Location: Tamil nadu
|
|
|
|
Thank you Frank. It gave the desired result. I got it as below,
| Code: |
****** ***************************** Top of Data ************
000001
000002
000003 PLEASE FIND THE BELOW DETAILS FOR EACH INDIVIDUAL
000004 AGE
000005 HEIGHT
000006 WEIGHT
000007
000008 STUDENT00001
000009 ------------
000010 19
000011 135
000012 40
000013 STUDENT00002
000014 ------------
000015 15
000016 123
000017 38
000018 STUDENT00003
000019 ------------ |
To add on it, can I get the result as below,( with the individual names displayed instead of STUDENT00001...)
I do have only 5 to 6 names/sections to be displayed , and not much...and so hope there is no need for a seperate i/p file to hold the names.
eg:
| Code: |
****** ***************************** Top of Data *********
000001
000002
000003 PLEASE FIND THE BELOW DETAILS FOR EACH INDIVIDUAL
000004 AGE
000005 HEIGHT
000006 WEIGHT
000007
000008 KATHERINE
000009 ------------
000010 19
000011 135
000012 40
000013 CLIVE
000014 ------------
000015 15
000016 123
000017 38 |
|
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| Quote: |
To add on it, can I get the result as below,( with the individual names displayed instead of STUDENT00001...)
I do have only 5 to 6 names/sections to be displayed , and not much...and so hope there is no need for a seperate i/p file to hold the names. |
Well, the names have to come from somewhere ... either hardcoded or a separate file or Symbols or somewhere. Do you just have a list of 6 names that you want to hardcode in the control statements that's always the same? If so, what are the names? If not, where do the names come from? |
|
| Back to top |
|
 |
Jasand
New User
Joined: 23 Jan 2009 Posts: 32 Location: Tamil nadu
|
|
|
|
Hi Frank,
I just need to hardcode 7 names as the titles for the seven groups which will be in the output as below,
| Code: |
****** ***************************** Top of Data *********
000001
000002
000003 PLEASE FIND THE BELOW DETAILS FOR EACH INDIVIDUAL
000004 AGE
000005 HEIGHT
000006 WEIGHT
000007
000008 KATHERINE
000009 ------------
000010 19
000011 135
000012 40
000013 CLIVE
000014 ------------
000015 15
000016 123
000017 38
000018 ROBERT
000019 ------------
000020 19
000021 135
000022 40
000023 SAM
000024 ------------
000025 15
000026 123
000027 38
000028 GEORGE
000029 ------------
000030 19
000031 135
000032 40
000033 LEENA
000034 ------------
000035 15
000036 123
000037 38
000038 GRACE
000039 ------------
000040 15
000041 123
000042 38 |
Thanks,
Jasand |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a DFSORT job for that:
| Code: |
//STEPA EXEC PGM=SORT,REGION=0M
//SORTIN DD DSN=... input file1 (FB/50)
// DD DSN=... input file2 (FB/50)
// DD DSN=... input file3 (FB/50)
// DD DSN=... input file4 (FB/50)
// DD DSN=... input file5 (FB/50)
// DD DSN=... input file6 (FB/50)
// DD DSN=... input file7 (FB/50)
//SORTOUT DD DSN=... output file (FB/100)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(23,5)),
IFTHEN=(WHEN=GROUP,RECORDS=3,PUSH=(24:ID=1)),
IFTHEN=(WHEN=(24,1,ZD,EQ,1),OVERLAY=(24:C'KATHERINE')),
IFTHEN=(WHEN=(24,1,ZD,EQ,2),OVERLAY=(24:C'CLIVE')),
IFTHEN=(WHEN=(24,1,ZD,EQ,3),OVERLAY=(24:C'ROBERT')),
IFTHEN=(WHEN=(24,1,ZD,EQ,4),OVERLAY=(24:C'SAM')),
IFTHEN=(WHEN=(24,1,ZD,EQ,5),OVERLAY=(24:C'GEORGE')),
IFTHEN=(WHEN=(24,1,ZD,EQ,6),OVERLAY=(24:C'LEENA')),
IFTHEN=(WHEN=(24,1,ZD,EQ,7),OVERLAY=(24:C'GRACE'))
OUTFIL REMOVECC,
HEADER1=(2/,
'PLEASE FIND THE BELOW DETAILS FOR EACH INDIVIDUAL',
/,5:'AGE',/,
5:'HEIGHT',/,
5:'WEIGHT',/),
BUILD=(1,5,100:X),
SECTIONS=(24,5,HEADER3=(24,9,/,'------------'))
/*
|
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|