Optocoupler paramethers
How much current flows in the output depends on the current transfer ratio
For the MOC8021, this is 1000% minimum (at the stated conditions):
The datasheet shows this:

What this means is that at DC, 1mA in the emitter will generate a collector current in the output of 10mA at the stated conditions (If = 10mA, Vce = 5V).
The CTR varies with varying forward current as shown in this normalised graph:

To get the actual CTR, multiply the CTR by the nominal CTR from the tables.
If you are then going to drive a PNP, you need to choose a device where the DC current gain is large enough to keep the required collector current below the 150mA maximum rating.
For a high side load you get something like this:



simulate this circuit &ndash; Schematic created using CircuitLab
Note that the collector emitter saturation voltage  can be as high as 2V so the emitter of the PNP may be as high as 2.7V
Note that the PNP will dissipate a power of 2.7V * Ic (max)
Using a low side load gets around this:



simulate this circuit
In here, when the optocoupler conducts, it pulls the PNP base down to get the device into saturation (about 0.1V Vce on the PNP), solving the power dissipation and saturation voltage issue.